Tips for avoiding typical errors:

Online shellcheck or the command line version via "dnf install ShellCheck": Checks shell script for different shells and gives hints on avoiding errors in your script.

Bash3boilerplate Starting point for new scripts and source of best practices

Bash does behave different if being called as sh (though I think it does not behave as sh/bourne shell). So there is a difference between #!/bin/sh and #!/bin/bash even if /bin/sh is a link to /bin/bash. zsh on the other hand behaves like sh when it is called via #!/bin/sh.

Good articles

Resources