#!/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