Cygwin shell script
am 20.12.2007 23:37:07 von zip184
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?
Re: Cygwin shell script
am 20.12.2007 23:49:25 von Janis Papanagnou
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
Re: Cygwin shell script
am 21.12.2007 02:37:18 von simon.greenberg
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