Results 1 to 3 of 3
Hello everybody. I'm pretty new with Linux and the bash shell. I have to make a menu and well... that part went fine. What I am having trouble with is ...
- 08-08-2011 #1Just Joined!
- Join Date
- Aug 2011
- Posts
- 1
menu script
Hello everybody. I'm pretty new with Linux and the bash shell. I have to make a menu and well... that part went fine. What I am having trouble with is the case at the bottom. When I input a letter it doesn't do anything. I created 4 executable scripts and gave everybody execute permission. They are mostly just cut and sort. Any input would be appreciated. Now its just a menu. That right there is the problem i think.
#[Ll]) ./empappL ;;
#[Ff]) ./empappF ;;
#[Cc]) ./empappC ;;
#[Ss]) ./empappS ;;
#[Qq]) ./exit ;;
Oh and also. They are in the same directory as the file that is being manipulated and the menu
empFile=~/source/empFile
loop=y
while [ "$loop" = y ]
do
clear
tput cup 3 12; echo "Employee Information Menu"
tput cup 4 12; echo "========================="
tput cup 6 9; echo "L - Print Last Names"
tput cup 7 9; echo "F - Print First Names"
tput cup 8 9; echo "C - Print Last Name sorted by city"
tput cup 9 9; echo "S - Print First Name, Last Name, State sorted by state"
tput cup 10 9; echo "Q - Exit the program"
read choice || continue
case $choice in
[Ll]) ./empappL ;;
[Ff]) ./empappF ;;
[Cc]) ./empappC ;;
[Ss]) ./empappS ;;
[Qq]) ./exit ;;
*) tput cup 14 4; echo "Invalid Code"; read choice ;;
esac
done
- 08-10-2011 #2
Do you actually have a script called exit in this directory? If not, and you want to use bash's built-in exit function, you need to write "exit", not "./exit".
"I'm just a little old lady; don't try to dazzle me with jargon!"
- 08-12-2011 #3Linux Guru
- Join Date
- May 2011
- Posts
- 1,842
Are you sure the scripts being called are not running? Put a sleep after the call to each script to see the output. Or log the output to a file. Also, you can probably exit after running the scripts, b/c right now, it just loops back to the menu (unless that's what you want). e.g.:
Code:[Ll]) ./empappL;sleep 5;exit; [Ff]) ./empappF > /tmp/empappF.log 2>&1;exit ;; [Cc]) ./empappC && echo success || echo failure;exit ;; [Ss]) ./empappS;exit ;;


Reply With Quote