diff options
author | John Ankarström <john@ankarstrom.se> | 2021-06-09 20:21:23 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-06-09 20:21:23 +0200 |
commit | 284b2b9f33bc3c8faf03fa77828495655e1054f4 (patch) | |
tree | c9ae19c3ae71bbce788c4b5c72e9d8000cc95d54 | |
parent | e482cc410962335a5bac7b3524f2a3fda8a3cac6 (diff) | |
download | xutil-284b2b9f33bc3c8faf03fa77828495655e1054f4.tar.gz |
xtopen: Add -K flag (keep window on error)
-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 "$@" |