ABck to the question: If you have
/bin/shas a link to bash, then bash will not behave the same when called as
/bin/shas it does when called as
/bin/bash. When called as
sh, it will limit itself to mostly POSIX-compliance plus a limited set of extensions.
Does it mean that whenever I come across a shell script in Linux with a shebang to sh:
#!/bin/sh, even if on that distro,
bin/sh is a symlink to another shell, like dash or bash, it should be 100% compatible with the bourne shell, since it limit itself to a limited set of extension? So I could execute them in FreeBSD? Is there are exception to that? Or I should be safe to assume that it will work?
So if on a distro,
bin/sh is a symlink to
bin/bash, and a script use
#!/bin/sh and the script contain bashism, it will not run, since bash will like be in sh mode?