It is running the bash executable you expect, but your shell is not simply bash; it is bash running in POSIX sh
compatibility mode. It does this by looking at the command name it was invoked as, and if that is sh
, then it automatically activates POSIX mode. It does a very terrible job at this, and should not be fully relied on for testing POSIX sh
compatible scripts, but it should considerably restrict allowed syntax.
--posix
Change the behavior of bash where the default operation differs from the POSIX standard to match the standard (posix mode).
See SEE ALSO below for a reference to a document that details how posix mode affects bash's behavior.
And from http://tiswww.case.edu/php/chet/bash/POSIX :
Starting Bash with the --posix
command-line option or executing set
-o posix
while Bash is running will cause Bash to conform more closely to the POSIX standard by changing the behavior to match that
specified by POSIX in areas where the Bash default differs.
When invoked as sh
, Bash enters POSIX mode after reading the startup
files.
until.sh
chmod +x util.sh
) and then run it with./util.sh
?