How do you execute test1.sh? If for example, you execute the script like
sh script1.sh
then you are bypassing the shebang on line one and script does not get executed with bash , but rather the default POSIX shell ( /usr/bin/sh ). If you want to use bash for that script, then you either need to make it executable with chmod and use:
That's right. I could reproduce what Scrutinizer said on my Linux as well.
When executed with sh it gave me an error because it bypasses the shebang.
But I came up with a question. Is there really a binary for sh in /usr/bin/sh in AIX? Because in Linux there's no executable or binary file for sh . sh is an internal behaviour of bash . The only executable of sh is a symbolic link to bash .
Another question, briefly, what are the = ( ) for?
@Kibou : That does not really matter. on AIX there are hard links from /usr/bin/sh/usr/bin/ksh , /bin/sh and /bin/ksh to the same ksh .
On many linux distribution there is a symbolic link from /bin/sh to /bin/bash . On derivatives of Debian this points to dash .
When it is symbolic link to bash and /bin/sh is called then bash acts as if it was called with the --posix option... Bash Reference Manual: Bash POSIX Mode