The UNIX and Linux Forums  

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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
syntex error script any suggestions kim187 Shell Programming and Scripting 5 04-29-2008 10:56 PM
awk Shell Script error : "Syntax Error : `Split' unexpected Herry UNIX for Dummies Questions & Answers 2 03-17-2008 07:16 AM
I got error like...syntax error on line 1, teletype koti_rama UNIX for Advanced & Expert Users 2 07-07-2007 04:35 PM
error reading sections error at install doelman SUN Solaris 2 02-05-2007 08:21 AM
Error: Internal system error: Unable to initialize standard output file firkus UNIX for Dummies Questions & Answers 2 10-25-2005 12:23 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-02-2001
Registered User
 

Join Date: Nov 2001
Location: san jose,ca
Posts: 6
Thumbs up syntex error

hi
I am try to run following script using c-shell but i get the following syntex error:-
----script---
---------------------------------------------------------------------------------
#!/bin/csh
echo "system monitor"
echo "
1) system paging
2) system file inf.
3) system disk inf.
4) current operating system.
5) print report
"
echo "select an option"
read choice
switch ($choice)
case 1:
sar -p 5
breaksw
case 2:
sar -u 5
breaksw
case 3:
diskusage -p
breaksw
case 4:
uname -a
breakesw
case 9:
breaksw
default:
echo 'Invalid choice'
breaksw
endsw

------------------------------------------------------------------------------------
sunserver% sh monitor
system monitor

1) system paging
2) system file inf.
3) system disk inf.
4) current operating system.
5) print report

select an option
5
monitor: syntax error at line 12: `switch' unexpected ----------------------------------------------------------------------------
__________________
nirbhai
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 12-03-2001
PxT's Avatar
PxT PxT is offline
Registered User
 

Join Date: Oct 2000
Location: Sacramento, CA
Posts: 905
I don't think csh understands the 'read' syntax the way you have used it. Try:

set choice=$<



Also see: <A HREF="http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/">CSH Programming Considered Harmful</A>
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 08:00 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0