![]() |
|
|
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 |
| end of file unexpected | naveeng.81 | Shell Programming and Scripting | 1 | 03-11-2008 06:43 AM |
| unexpected 'end of file' + sed command | kamel.seg | High Level Programming | 1 | 02-08-2008 11:00 AM |
| unexpected end of file | dineshr85 | Shell Programming and Scripting | 2 | 10-15-2007 03:47 AM |
| gunzip: unexpected end of file | sicjedi | UNIX for Advanced & Expert Users | 4 | 09-15-2006 11:41 AM |
| 'end of file' unexpected | abhijeetkul | Shell Programming and Scripting | 4 | 04-10-2006 07:42 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
'end of file' unexpected
HI,
I was converting a .bat file to .sh file for unix Code snippet #!/usr/bin/sh set -x if [ "$1" = "" ] then goto RegularBuild; CURDIR="$1"; cd "$CURDIR"; :RegularBuild echo "Checking for existing fip_help.properties in def/properties directory..." if [ -f fip_help.properties ] then rm -f fip_help.properties; if [ -f ../../def/properties/fip_help.properties ] then goto found; echo "fip_help.properties not found in def/properties directory" goto gen; :found echo "Found fip_help.properties in def/properties directory." echo "Copying fip_help.properties from def\properties directory..." cp ../../def/properties/fip_help.properties . goto gen; :gen fip_help_gen.sh ../../xml/fip_navigation.xml ../../xsl/fip_popups.xsl if [ ! -f fip_help.properties ] then goto error; echo "Copying fip_help.properties to def/properties directory..." cp fip_help.properties ../../def/properties/ . chmod 444 ../../def/properties/fip_help.properties echo "fip_help.properties file placed in def/properties directory." goto end :error echo "fip_help.properties file generation failed" goto end :end echo "completed" set +x End of code snippet Could someone point me where I went wrong... Thanks, Sreeku |
|
||||
|
It's still waiting for the "then" for the first if. And after that, it will want the "fi". The if syntax requires then to be on a separate line, or have a semicolon in front; and there must be a fi to show where the if block ends.
Consider: Code:
if grep moo file.txt |
many more commands |
in a complex pipeline |
yielding a result which decides whether the "if" is true or not
then
commands to execute if the outcome was true
there could be many commands here too
many many more, in fact
fi
unconditional commands ...
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|