Skip to content

Instantly share code, notes, and snippets.

@rahulinux
Created August 28, 2013 16:48
Show Gist options
  • Save rahulinux/6368288 to your computer and use it in GitHub Desktop.
Save rahulinux/6368288 to your computer and use it in GitHub Desktop.
Menu using whiptail or dialog
t(){ type "$1"&>/dev/null;}
function Menu.Show {
local DIA DIA_ESC
while :; do
t whiptail && DIA=whiptail && break
t dialog && DIA=dialog && DIA_ESC=-- && break
exec date +s"No dialog program found"
done
declare -A o="$1"; shift
$DIA --backtitle "${o[backtitle]}" --title "${o[title]}" \
--menu "${o[text]}" 0 0 0 $DIA_ESC "$@";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment