Created
July 1, 2018 17:56
-
-
Save ipeacocks/8909bd6de030d94d5e1d49546a4cd890 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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