![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to build a command into a string rather than execute the command | littlejon | Shell Programming and Scripting | 1 | 05-29-2008 08:05 PM |
| to execute the command swlist | vivek_damodaran | HP-UX | 6 | 11-09-2007 05:56 PM |
| awk and execute command ??? | sabercats | Shell Programming and Scripting | 13 | 03-28-2006 06:12 PM |
| Plz Help : How to use write command to execute command on some other terminal | Aashish | UNIX for Dummies Questions & Answers | 2 | 03-03-2006 12:25 PM |
| How does this command execute? | saneeshjose | UNIX for Dummies Questions & Answers | 3 | 01-03-2006 10:46 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
hi,
i am try to run the following script - i just can not execute it. ***************************************************** #!/bin/sh echo "system monitor" echo " 1) system paging 2) system file inf. 3) system disk inf. " echo "select an option" read choice case $ choice in 1) sar -p;; 2) sar -u;; 3) diskusage -p;; esac ~ ~ ~ ~ ~ ~ ~ ~ ~ "monitor" 14 lines, 229 characters |
|
||||
|
Also, your case statement must not have a space following the dollar-sign. It needs to be $choice. And if you are wanting this menu to repeat, you can put it in a while-statement like:
#!/bin/sh choice=0 while [ $choice -ne 9 ] do echo "system monitor" echo " 1) system paging 2) system file inf. 3) system disk inf. 9) exit " echo "select an option: \c" read choice case $choice in 1) sar -p;; 2) sar -u;; 3) diskusage -p;; 9) ;; *) echo 'Invalid choice' sleep 1;; esac done |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|