diff options
author | Ensa <psychoticfervor@tuta.io> | 2019-12-20 00:14:09 -0800 |
---|---|---|
committer | Ensa <psychoticfervor@tuta.io> | 2019-12-20 00:14:09 -0800 |
commit | 4684d80b6271dd775cd23dabf2b91d6ce56fa33a (patch) | |
tree | ddb6c6219e213132b8500e016b1ce238aa71029d /bin/prompt | |
parent | f733ca7c8041866df27752c8e0c2610e0ecef6a7 (diff) | |
download | cfg-4684d80b6271dd775cd23dabf2b91d6ce56fa33a.tar.gz |
first significant commit
see README.md for information
Diffstat (limited to 'bin/prompt')
-rwxr-xr-x | bin/prompt | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/bin/prompt b/bin/prompt new file mode 100755 index 0000000..ac1a319 --- /dev/null +++ b/bin/prompt @@ -0,0 +1,10 @@ +#!/bin/sh +# calls dmenu with $1 as the prompt and "no" and "yes" as the options. +# if "yes" is chosen, call $2. +if [ $# -eq 1 ]; then + case "$1" in + [!-]*|-*[!h]*) return 1 ;; + *h*) printf 'usage: %s [-h]|prompt cmd\n' "$(basename $0)">/dev/stderr&&return 1 ;; + esac +fi +[ "$(printf "no\\nyes"|dmenu -p "$1")" = "yes" ] && $2 |