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 > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
awk Shell Script error : "Syntax Error : `Split' unexpected Herry UNIX for Dummies Questions & Answers 2 03-17-2008 11:16 AM
error during run: St9bad_alloc - Getting this error while using some conversion progr sathu_pec Shell Programming and Scripting 1 01-21-2008 02:38 AM
I got error like...syntax error on line 1, teletype koti_rama UNIX for Advanced & Expert Users 2 07-07-2007 07:35 PM
error reading sections error at install doelman SUN Solaris 2 02-05-2007 12:21 PM
Error: Internal system error: Unable to initialize standard output file firkus UNIX for Dummies Questions & Answers 2 10-25-2005 03:23 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-23-2003
props props is offline
Registered User
  
 

Join Date: Oct 2003
Location: uk
Posts: 15
error

Hello
Any idea where is the error ?
*)
echo " Wrong selection. Try again "
continue
;;
esac
done
echo "Done"

Thanks alot
  #2 (permalink)  
Old 12-23-2003
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,114
You can't have an "esac" unless you have a "case" first. Nor a "done" without a "do".
  #3 (permalink)  
Old 12-23-2003
props props is offline
Registered User
  
 

Join Date: Oct 2003
Location: uk
Posts: 15
it gives an error like this
syntax error at line 43: `end of file' unexpected



the above code saws only the end of the script

ive got the case and do in my code
  #4 (permalink)  
Old 12-23-2003
tikual tikual is offline
Registered User
  
 

Join Date: Nov 2003
Location: HK
Posts: 53
How to guess your whole script?

Pls. post your script to here.
  #5 (permalink)  
Old 12-23-2003
props props is offline
Registered User
  
 

Join Date: Oct 2003
Location: uk
Posts: 15
echo " a.read a file"
echo " b.create a file"
echo " c.add on existing file"
echo " d. exit"
"; do
echo "Enter a,b,c or d: \c"
read answer
echo
case "$answer" in
a)

read answer
cat $answer
;;
b)

read answer
echo
cat> $answer
;;
c)

read answer
echo
cat>> $answer
;;
d)
break
;;
*)

continue
;;
esac
done
echo "Done"
  #6 (permalink)  
Old 12-23-2003
tikual tikual is offline
Registered User
  
 

Join Date: Nov 2003
Location: HK
Posts: 53
What is the meaning of in line 5
Code:
"; do
??

You may use 'select' to do the same thing more convenience.

PS3="Enter your choice > "
select answer in "read a file" "create a file" "add on existing file" exit;
do
case "$answer" in
1)

read answer
cat $answer
;;
2)

read answer
echo
cat> $answer
;;
3)

read answer
echo
cat>> $answer
;;
4)
exit
;;
*)

print 'Invalid input'
;;
esac
done
  #7 (permalink)  
Old 12-23-2003
jayakhanna jayakhanna is offline
Registered User
  
 

Join Date: Dec 2003
Location: India
Posts: 50
I suppose this is what you were intending to do

Regards
JK

echo " a.read a file"
echo " b.create a file"
echo " c.add on existing file"
echo " d. exit"

while [ true ]
do
echo "Enter a,b,c or d: \c"
read answer
echo
case "$answer" in
a)
cat $answer
;;
b)
cat> $answer
;;
c)
cat>> $answer
;;
d)
exit
break
;;
*)
echo "option should be a, b or c"
;;
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 07:51 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