What is the actual difference between sh and bash? Based on what I've read online, sh is essentially an alias for bash; running a shellscript with sh will behave the same as if it's run with bash.
In my experience this is not entirely true, as newlines are processed differently. What exactly is the difference between sh and bash, and as zsh is now the default shell does anyone know if sh will change in future versions of Mac OS?
Consider the following code:
sh -c &quot;echo \&quot;Hello\nWorld\&quot;&quot;

This should produce the following output:
Hello
World

However when run with bash:
bash -c &quot;echo \&quot;Hello\nWorld\&quot;&quot;

The newline is not output:
Hello\nWorld

Thanks in advance!
The long answer on this has already been written, see https://stackoverflow.com/questions/5725296/difference-between-sh-and-bash.
The echo builtin is one (of several) things where sh and bash differ. To get bash to handle \n as a control character use echo -e.
$ bash -c &quot;echo -e \&quot;Hello\nWorld\&quot;&quot;
Hello
World

As for the definition of sh on macOS, see man sh (e.g. on Big Sur):
sh is a POSIX-compliant command interpreter (shell).  It is implemented by re-execing as 
either bash(1), dash(1), or zsh(1) as determined by the symbolic link located at 
/private/var/select/sh. If /private/var/select/sh does not exist or does not point to a
valid shell, sh will use one of the supported shells.

So basically executing sh will execute whichever shell /private/var/select/sh points to in &quot;sh/POSIX compatibility mode&quot;.