I would like to use whiptail to create a toolbox which runs external scripts when a menu item is chosen.
I have the following code
#!/bin/bash
OPTION=$(whiptail --title "IT ToolBox v0.1" --menu "Choose your option" 15 60 4 \
"1" "Get users dropped from Active Directory" \
"2" "Work in progress" \
"3" "Work in progress" \
"4" "Work in progress" 3>&1 1>&2 2>&3)
exitstatus=$?
if [ $exitstatus = 0 ]; then
echo "Your chosen option:" $OPTION
else
echo "You chose Cancel."
fi
case $RETVAL in
1) echo "Get users dropped from Active Directory"
2) echo "Invalid option. Quitting";;
3) echo "Invalid option. Quitting";;
4) echo "Invalid option. Quitting";;
*) echo "Invalid option. Quitting";;
esac
How do I tell the script to execute the file gudfad.sh when chosen? My understanding is that the command is to be added in the case area -- for example:
case $RETVAL in
1) echo "Get users dropped from Active Directory"
gudfad.sh;;
2) echo "Invalid option. Quitting";;
3) echo "Invalid option. Quitting";;
4) echo "Invalid option. Quitting";;
*) echo "Invalid option. Quitting";;
esac
However, when I run this and choose option 1, I get the message:
Your chosen option: 1
Invalid option. Quitting
$RETVALis an empty string.