about summary refs log blame commit diff stats
path: root/bin/prompt
blob: ac1a31906a297afb260f3ab29a4798d7e8e280ea (plain) (tree)
1
2
3
4
5
6
7
8
9
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