![]() |
|
|
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 |
| 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 |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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. |
|
||||
|
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 '$'. |
|
||||
|
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 |
|
||||
|
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. |
![]() |
| Bookmarks |
| Tags |
| linux |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|