![]() |
|
|
|
|
|||||||
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. Shell Script Page. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Passing global variable to a function which is called by another function | sars | Shell Programming and Scripting | 4 | 3 Weeks Ago 08:39 AM |
| My menu function [new code -revised] | amatuer_lee_3 | Shell Programming and Scripting | 3 | 05-18-2008 04:05 AM |
| CDE menu | gabim | AIX | 1 | 10-20-2003 03:17 AM |
| Sub menu's | Makaveli.2003 | UNIX for Dummies Questions & Answers | 20 | 01-21-2002 06:15 AM |
| Menu function stuck in a loop? | darthur | UNIX for Dummies Questions & Answers | 2 | 12-14-2001 12:16 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
My menu function
Below is my menu options code. It allows user to pick one of two option. I can get the first option to work, because if it is selected it just "breaks" and carries on with the script.
What i want to know is if a user selects option two how do i get that option to ignore all the other script and go to another specific part to carry out other commands??? ( i have indicated the problem by putting ########) Code:
while true; do
echo " "
echo "Main Menu: "
echo "Please Select An Option Using The Options Provided."
echo " "
echo "1 - Search All Files"
echo " "
echo "2 - Idex Page Information"
echo " "
echo "Q - Quit"
echo " "
echo "Please enter your option: "
read CHOSEN_KEY
case $CHOSEN_KEY in
[1]) echo " "
echo "You Have Selected To Search All Files For Hits"
break;; # By using break i carry on my script which works correctly.
[2]) echo " "
echo "You Have Selected To Access Index Page Information"
######;;
Q|q) echo " "
echo "Goodbye"
exit;;
esac
done
Last edited by amatuer_lee_3; 05-17-2008 at 07:14 PM. |
| Forum Sponsor | ||
|
|
|
|||
|
What do you mean by "make my menu run"? What errors do you get? Do you have a problem starting it like
Code:
me@mybox$ mymenu.sh Code:
me@mybox$ ./mymenu.sh |
|
|||
|
Code:
[2]) echo " "
echo "You Have Selected To Access Index Page Information"
###What do i put here to make it go to a new set of funtions###;;
Code:
[2]) echo " "
echo "You Have Selected To Access Index Page Information"
readindex;;
###and have later in my code####
readindex () {
echo "hello"
}
Last edited by amatuer_lee_3; 05-17-2008 at 06:40 PM. |
|
|||
|
please see other post:
My menu function [new code -revised] But in reply to your questions: .hits files are numerous files populated with hundres of rows in the format: Code:
137.44.2.8 Mon Feb 4 22:02:35 GMT 2008 149.192.2.81 Mon Feb 4 23:22:12 GMT 2008 132.53.17.171 Tue Feb 5 01:56:16 GMT 2008 I am using a grep command to do so. Secondly I use the case command to validate all of these inputs the user makes. The reason i have not grouped it all together, is because i dont know how. Unlike most "students" on here i tend to only use what i understand or know. compared to people who just post hwk on here, and if i need help with a command then i come to here. Although this has nothing to do with coursework, and is just a mess about task for me to help me with my placement for next year where i will be having unix and perl experience. I am a complete beginner to this. The reason there are pauses is because its just so i can see if everything runs ok and it gives me time to look at it. If you refer to the link above you will see the problem. I want my "option 2" in my menu to ignore the stuff i already have in place, and run something else in the same script. Sorry to be such a lamen about this whole thing but its the first time ive extensively used UNIX. Last edited by amatuer_lee_3; 05-17-2008 at 07:33 PM. |
|||
| Google UNIX.COM |
| Thread Tools | |
| Display Modes | |
|
|
|
The 50 most popular UNIX and Linux searches.
Google Search Cloud for The UNIX and Linux Forums
|
| "inappropriate ioctl for device" 421 service not available, remote server has closed connection ^m autosys awk trim bash eval bash exec bash for loop boot: cannot open kernel/sparcv9/unix close_wait command copy/move folder in unix curses.h cut command in unix dead.letter find grep find null character in a unix file grep multiple lines grep or grep recursive grep unique inappropriate ioctl for device logrotate.conf lynx javascript mailx attachment mget mtime perl array length ping port remove first character from string in k shell replace space by comma , perl script scp recursive segmentation fault(coredump) sftp batch sftp script snoop unix stale nfs file handle syn_sent tar exclude unix unix .profile unix com unix forum unix forums unix interview questions unix mtime unix simulator unix.com vi tab size vi+substitute+end+of+line+character while loop within while loop shell script |