Cygwin shell script - shell
This is a discussion on Cygwin shell script - shell ; I'm trying to write a shell script (im using cygwin: Win XP) and I'm getting an error "line 5: synatx error: unexpected end of file" filename: asdf.sh ----------------------------------- #! /bin/sh if [ $# -ne 3 ]; then echo "bla bla" ...
![]() |
| | LinkBack | Thread Tools | Display Modes |
|
#1
| |||
| |||
| getting an error "line 5: synatx error: unexpected end of file" filename: asdf.sh ----------------------------------- #! /bin/sh if [ $# -ne 3 ]; then echo "bla bla" fi ----------------------------------- I can't for the life of me figure out why, can anybody help? |
|
#2
| |||
| |||
| zip184@gmail.com wrote: > I'm trying to write a shell script (im using cygwin: Win XP) and I'm > getting an error "line 5: synatx error: unexpected end of file" > > filename: asdf.sh > > ----------------------------------- > #! /bin/sh > if [ $# -ne 3 ]; then > echo "bla bla" > fi > ----------------------------------- > > I can't for the life of me figure out why, can anybody help? Does Cygwin dislike CR-LF line terminators? Try saving the file with an editor that can terminate lines with LF only. Or use commands like dos2unix on your script file. Janis |
|
#3
| |||
| |||
|
On Dec 20, 2:37*pm, zip...@gmail.com wrote: > I'm trying to write a shell script (im using cygwin: Win XP) and I'm > getting an error "line 5: synatx error: unexpected end of file" > > filename: asdf.sh > > ----------------------------------- > #! /bin/sh > if [ $# -ne 3 ]; then > * echo "bla bla" > fi > ----------------------------------- > > I can't for the life of me figure out why, can anybody help? I'm using CygWin as well on WinXP. File test.sh I created using vi: $ cat test.sh #! /bin/sh if [ $# -ne 3 ]; then echo "bla bla" fi if [ $# -eq 3 ]; then echo "wow 3" fi $ ./test.sh 1 2 3 wow 3 $ ./test.sh bla bla $ Cheers, --S |
|
#4
| |||
| |||
|
Hey I had this problem in Cygwin. It was the CRLF problem or end of file markers that must have done it. I used Text Pad to save the script in Linux format rather than PC format and it's fixed.
|
|
#5
| |||
| |||
|
In the shell script file (hello_world.sh), give the full path to java.exe For e.g., instead of java -class path java_test_programs Hello World type this in the hello_world.sh: "c:\jdk\bin\java.exe" -class path java_test_programs Hello World If that doesn't work, there are several other reasons for that error. Try the solutions given here: I'm fairly certain \r is not white space anywhere. It is the carriage return character (similar to how one needs to throw the typewriter carriage back to its original position on a newline). Why couldn't you just use ' '? |
![]() |
« Previous Thread
|
Next Thread »
| Thread Tools | |
| Display Modes | |
| |
All times are GMT -4. The time now is 01:55 AM.




Linear Mode