![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| 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 07:16 AM |
| "syntax error at line 21 :'done' unexpected." error message" | ibroxy | Shell Programming and Scripting | 3 | 08-08-2007 03:45 AM |
| syntax error at line 59: `end of file' unexpected | Remi | SUN Solaris | 4 | 01-16-2007 10:48 AM |
| syntax error at line 33: `elif` unexpected | hazy | UNIX for Dummies Questions & Answers | 4 | 02-09-2006 10:51 AM |
| sh: syntax error at line 1: `>' unexpected | atiato | High Level Programming | 2 | 03-16-2004 03:39 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
for loop not working - syntax error at line 6: `end of file' unexpected
I have a file called test.dat which contains
a b I have written a shell script called test.sh for i in `cat test.dat` do echo $i done When i run this script using sh test.sh I get this message - test.sh: syntax error at line 6: `end of file' unexpected What is the problem. Thanks, Debojyoty |
| Forum Sponsor | ||
|
|
|
|||
|
It also occurred to me that one of you back ticks could be a single quote as well, which would certainly cause your error.
Code:
for i in `cat test.dat' <=== single quote and not back tick do echo $i done $ sh test.sh test.sh: syntax error at line 5: `end of file' unexpected Code:
for i in `cat test.dat` <=== back tick do echo $i done $ sh test.sh a b |
|||
| Google The UNIX and Linux Forums |