will either use the default shell or invoke legacy
1980s compatibility mode.
Either way, a shell script using the general
#!/bin/sh may fail on other computers.
To improve shell script robustness, specify a particular shell with the shebang.
Popular shells besides Bash include
which is the MacOS default.
To have even better cross-platform robustness, consider using Python instead of shell scripts.
The default shell is selectable in the shebang in the first line of the “my_script.sh” shell script. For example, to specify Bash shell, put as the first line:
The currently used shell is revealed by:
this $SHELL variable may not strictly be the “default” shell if you have scripts changing the shell on interactive login. Other users may choose a different default shell.
To run a script in a specific shell, do like:
To permanently change user default shell use chsh.