The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-24-2001
neer45 neer45 is offline
Registered User
  
 

Join Date: Nov 2001
Location: san jose,ca
Posts: 6
Unhappy execute command

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
  #2 (permalink)  
Old 11-24-2001
Neo's Avatar
Neo Neo is online now Forum Staff  
Administrator
  
 

Join Date: Sep 2000
Location: Asia Pacific
Posts: 6,665
[list=1][*]chmod 755 monitor[*]./monitor[/list=1]
  #3 (permalink)  
Old 11-25-2001
Jimbo
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:30 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0