If you have worked with shell script before, you might be wondering why we used #!/bin/bash as our shebang in all our examples, and not #!/bin/sh. Many users think that the /bin/sh and /bin/bash programs work the same way as shell script interpreters on every system. This is not true – there are important differences between the two.
The most important difference is that /bin/sh may not even be the same program as /bin/bash, and may therefore lack many of the programming features Bash adds that are not specified by the POSIX standard. Some GNU/Linux systems use bash as their /bin/sh implementation (Arch Linux, CentOS), but others do not (Debian GNU/Linux, Ubuntu).
When Bash is called as sh, it changes its behavior slightly to be consistent with the way the /bin/sh program is expected to work. However, most of its special features, such as the advanced [[ syntax, still work even in this mode. This means that a script with #!/bin/sh as the interpreter that uses Bash features might work on one system, and not another. This can even change over time: if your system of choice changes its /bin/sh implementation from Bash to another shell, as Debian GNU/Linux did, your script may stop working correctly after an upgrade where it appeared to be working fine before.
If you're writing a Bash script, use a bash shebang. This makes clear to both the system and to anyone reading your script what shell it should run in. If you use /bin/sh while using non-POSIX features, the system may get it wrong, and the user will have to guess.