aboutsummaryrefslogtreecommitdiff
path: root/xtopen
diff options
context:
space:
mode:
Diffstat (limited to 'xtopen')
-rwxr-xr-xxtopen17
1 files changed, 14 insertions, 3 deletions
diff --git a/xtopen b/xtopen
index af284e4..540f4bd 100755
--- a/xtopen
+++ b/xtopen
@@ -14,14 +14,25 @@ abbr() {
if [ $# -eq 0 ]; then
xmessage -buttons sorry:0 -default sorry -nearmouse \
- error: missing argument
+ "usage: $0 [-K] cmd ..."
exit 1
fi
+flagK=
+case "$1" in
+-K) flagK=-K
+ shift ;;
+-*) xmessage -buttons sorry:0 -default sorry -nearmouse \
+ error: "unknown flag $1"
+ exit 1 ;;
+esac
+
if ! which "$1" 2>/dev/null; then
xmessage -default okay -nearmouse \
- error: program "$1" not found
+ error: "program $1 not found"
exit 1
fi
-exec xterm -title "$* (`abbr "$PWD"`)" -e "$@"
+[ -z "$flagK" ] &&
+exec xterm -title "$* (`abbr "$PWD"`)" -e "$@" ||
+exec xterm -title "$* (`abbr "$PWD"`)" -e with-shell-on-error "$@"