diff options
Diffstat (limited to 'xtopen')
-rwxr-xr-x | xtopen | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -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 "$@" |