I started writing a script to save the files from a camera I got the other day, which mounts in /Volumes , and I got into it and started building this menu. The only problem is that the switch case is coming up as a syntax error at the parenthesis after a case. Here is the code:
while :
do
clear
echo "-----Menu for Camera Save Script-----"
echo " Main Menu "
echo "-------------------------------------"
echo "[1] Save to dir: Todays date/time"
echo "[2] Save files custom dir: "
echo "[5] Exit/Stop"
echo "======================="
echo -n "Enter your menu choice [1,2,5]: "
read yourch
case "$yourch" in
1)
mkdir $HOME/Pictures/`date +%d_%m_%H%M`;
mv /Volumes/SpyCam/_REC/100MEDIA/* $HOME/Pictures/`date +%d_%m_%H%M`;
;;
2)
echo "Enter Name of New Dir: ";
read `newdir`;
mkdir $HOME/Pictures/$newdir;
mv /Volumes/SpyCam/_REC/100MEDIA/* $HOME/Pictures/$newdir;
;;
5)
exit 0;
;;
*)
echo "No try 1, 2 or 5.";
echo "Press a key. . .";
read;
;;
esac
done
As you can see, it displays the menu, and once it does that, it waits for two options, one for an auto named directory with the date and time, or one for a custom named directory. It won't work though. it says there is an unexpected parentheses at 1).
Thanks for anyone who tries to figure this out.
oh, also, I am executing within bash.