Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ipeacocks/8909bd6de030d94d5e1d49546a4cd890 to your computer and use it in GitHub Desktop.
Save ipeacocks/8909bd6de030d94d5e1d49546a4cd890 to your computer and use it in GitHub Desktop.
#!/bin/bash
TMPFCMD="/tmp/cmd.tmp"
dialog --title 'Execute command' --menu 'Chose program to launch:' 0 0 0 \
l 'ls -la' \
p pwd \
d date \
u 'uname -a' \
w whoami 2> $TMPFCMD
CMD2RUN=$(cat $TMPFCMD)
if [ "$?" -eq "0" ]; then
case "$CMD2RUN" in
"l")
ls -la
command="ls -la"
;;
"p")
pwd
command="pwd"
;;
"d")
date
command="date"
;;
"u")
uname -a
command="uname -a"
;;
"w")
whoami
command="whoami"
;;
esac
fi
echo $command
rm -f $TMPFCMD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment