For portability reasons I prefer to write POSIX shell scripts instead of Bash scripts:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V...
I used to think that way, but POSIX is not that well specified and there are tons of little behavior changes that makes the task difficult past 10 lines of code. Writing portable shell scripts is like writing portable JavaScript in the IE days.
https://github.com/dylanaraps/pure-sh-bible is a good example if you look at the issue tracker.
Once you accept Bash as a standard things become much easier. Basically Bash arrays, the `@Q` notation and ShellCheck combined solve all of the escaping issues that plague shell scripts.