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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Help with ELIF statement Brewer27 UNIX for Dummies Questions & Answers 4 05-18-2008 08:02 PM
have a problem with if elif loop .. plz help me with the script Syms UNIX for Dummies Questions & Answers 4 11-01-2007 02:59 AM
IF THEN ELIF question in BOURNE SHELL arun_st UNIX for Dummies Questions & Answers 4 04-20-2007 01:41 PM
If..elif..else...fi Rock Shell Programming and Scripting 2 02-08-2007 06:32 AM
if...elif...fi condition in Unix abidmalik UNIX for Dummies Questions & Answers 9 09-05-2002 09:35 AM

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 07-25-2005
pv0428 pv0428 is offline
Registered User
  
 

Join Date: Jul 2005
Posts: 5
elif not expected

Hi,
I have a shell script which runs fine when i do it from Unix simulator on Widnows.
When i try to run the same for Unix it throws me the error
syntax error at line 87: `elif' unexpected.

Piece of code for the same is

while [ "$#" != "0" ]
do
if [ "$1" = "-config" ]; then
shift
configFile="$1"
shift
elif [ "$1" = "-cvstag" ]; then
shift
CVS_TAG_NAME="$1"
shift
elif [ "$1" = "-compilejsps" ]; then
shift
COMPILE_JSPS="on"
else
shift
fi
done


Please help me out.
It gives me another error \377: not found.
If some one can share his maild id ,i can send across the file.
  #2 (permalink)  
Old 07-25-2005
pixelbeat pixelbeat is offline
Registered User
  
 

Join Date: Jun 2005
Location: Ireland
Posts: 61
works fine on linux/bash.

What system/shell are you trying on?

That 377 error is weird?

$ echo -e "\377" | recode l1..
ÿ
  #3 (permalink)  
Old 07-25-2005
Unbeliever Unbeliever is offline
Registered User
  
 

Join Date: Jul 2005
Location: England
Posts: 183
Sounds like you have a non ascii character in your file. try runnig the following command:

cat -vet yourfile.sh | more

This will convert any funny charcters to a viewable form and mark the real end of each line with a '$'.
  #4 (permalink)  
Old 07-25-2005
pv0428 pv0428 is offline
Registered User
  
 

Join Date: Jul 2005
Posts: 5
I am still getting the same errors after
running the command cat -vet doCodeDeployment.sh | more and executing my script.
As communciated it appended an $ at the end of each line in the script.
I have uploaded the file also.
  #5 (permalink)  
Old 07-25-2005
pv0428 pv0428 is offline
Registered User
  
 

Join Date: Jul 2005
Posts: 5
We are trying to run them on Unix Box...
  #6 (permalink)  
Old 07-25-2005
giannicello giannicello is offline
Registered User
  
 

Join Date: Sep 2001
Location: Phoenix
Posts: 169
I ran it on a unix box and it worked fine...

The only question I have is if you really wanted the last elif and else condition to both run. Without the shift after COMPILE_JSPS="on", the else command ran also when the argument was -compilejsps:

while [ "$#" != "0" ]; do
if [ "$1" = "-config" ]; then
shift
configFile="$1"
echo "config $1"
shift
elif [ "$1" = "-cvstag" ]; then
shift
CVS_TAG_NAME="$1"
echo "cvstag $1"
shift
elif [ "$1" = "-compilejsps" ]; then
shift
COMPILE_JSPS="on"
echo "jsps set to $1"
shift
else
shift
echo "nothing"
fi
done

Gianni
  #7 (permalink)  
Old 07-25-2005
pv0428 pv0428 is offline
Registered User
  
 

Join Date: Jul 2005
Posts: 5
We are trying to run this on Solaris 8.
The script runs fine on Windows using Unix emulator.
whoever tried to run the sampel piece of code above says it is fine.
We are getting an error on Solaris8.
I removed

elif [ "$1" = "-compilejsps" ]; then
shift
COMPILE_JSPS="on"
else
shift

and ran the code it,does not throw me an error but does not work...
What differences does it amke on Solaris.
The Script is attached.
Closed Thread

Bookmarks

Tags
linux

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 10:17 AM.


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