Cygwin bash syntax error - but script run perfectly well in Ubuntu

Posted by Michael Mao on Stack Overflow See other posts from Stack Overflow or by Michael Mao
Published on 2010-03-25T22:51:35Z Indexed on 2010/03/25 22:53 UTC
Read the original article Hit count: 304

Filed under:
|
|
#!/bin/bash
if test "$#" == "4"; then echo "$*"; else echo "args-error" >&2; fi;

This little code snippet troubles me a lot when I tried to run it on both Ubuntu and Cygwin.

Ubuntu runs bash version 4.0+ whereas Cygwin runs 3.2.49; But I reckon version collision shall not be the cause of this, this code runs well under fedora 10 which is also using bash version 3.+

So basically I am wondering if there is a way to code my script once and for all so there are not to have this awful issue later on.

Many thanks in advance.

© Stack Overflow or respective owner

Related posts about shell

Related posts about bash