|
Home > Archive > Unix Shell > December 2007 > Cygwin shell script
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Cygwin shell script
|
|
| zip184@gmail.com 2007-12-20, 7:21 pm |
| 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?
| |
| Janis Papanagnou 2007-12-20, 7:21 pm |
| 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
| |
| comp.unix.shell 2007-12-21, 1:48 am |
| On Dec 20, 2:37=A0pm, 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
> =A0 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
|
|
|
|
|