1 2 3 4 5 6 7 8 9
if [ "$MENUCMD" ] && [ -z "${inp:=$1}" ] then inp="$($MENUCMD < /dev/null)" else echo "input:" >&2 read inp fi test -z "$inp" && exit 1