Results 1 to 8 of 8
how would i script in menus? like get in the script and have a multiple choice press 1 for this and 2 for that kinda thing?...
- 05-19-2007 #1Just Joined!
- Join Date
- Nov 2006
- Posts
- 90
scripting menus
how would i script in menus? like get in the script and have a multiple choice press 1 for this and 2 for that kinda thing?
- 05-19-2007 #2Linux User
- Join Date
- Aug 2006
- Posts
- 458
you should get to know these :
1) read
2) while /for loops
3) if/test conditionals
4) echo/printf
5) sed/awk ?
etc
but first, pls check this out
- 05-20-2007 #3Linux Engineer
- Join Date
- Apr 2006
- Location
- Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
- Posts
- 1,117
Hi.
If you learn better from examples, then in the last link there are two sections that may be of interest:
http://www.tldp.org/LDP/abs/html/testbranch.html#EX30
and
http://www.tldp.org/LDP/abs/html/testbranch.html#EX31
Note that you may need some of the other links posted to understand the code ... cheers, drlWelcome - get the most out of the forum by reading forum basics and guidelines: click here.
90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
We look forward to helping you with the challenge of the other 10%.
( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )
- 05-21-2007 #4Just Joined!
- Join Date
- Nov 2006
- Posts
- 90
thanks! that worked! ok, one more thing, is there a command to mount all non-mounted hdd's all @ once?
- 05-21-2007 #5Just Joined!
- Join Date
- Nov 2006
- Posts
- 90
oh and if i want to find a file and execute it, like find an update file and use it, but im not sure what drive it may be on.and if i want the menu to complete commands but go back to the menu without exiting. im new at this and only have internet at work and i cant do much reading here
- 05-21-2007 #6man mount will do the trick
Originally Posted by jwmw1023 
Drive? What's a drive?
Originally Posted by jwmw1023
Maybe the find command will do this for you. If you have no idea where your file is, just search the whole system with:
Code:find / -name file -print
If you're writing menu's just keep this basic format:
Originally Posted by jwmw1023
Code:while true; do clear echo $FEEDBACK echo "1. Option 1" echo "2. Option 2" echo "exit" echo echo -n "I'm waiting for instructions, my Master " read INSTR case $INSTR in 1) FEEDBACK="You chose 1" ;; 2) FEEDBACK="You chose 2" ;; exit) exit ;; *) FEEDBACK="Invalid option" ;; esac done
- 05-21-2007 #7Just Joined!
- Join Date
- Nov 2006
- Posts
- 90
ok what if i need to find and then execute something automagically? i need to have my updated scripts on a flash dr that can be automagically found and used on multiple machines on which the dr designation may move. the script needs to hunt it out by filename and use it. I PROMISE ILL LEAVE U GUYS ALONE WHEN I GET INTERNET @ MY HOUSE IN @ WEEKS!!!
- 05-21-2007 #8Just Joined!
- Join Date
- Nov 2006
- Posts
- 90
and what if i need press any key to continue functionality? sleep doesnt seem to do this
edit: nevermind read -n 1 foo seems to work (i have no idea what it means, i just found it)


Reply With Quote
