Maybe the discussion should start at: Can you even do anything safely in Bash? -
https://mywiki.wooledge.org/BashPitfalls
Luckily, most commonly encountered scripting issues are with whitespace in filenames/variables and running a script through shellcheck will catch most (all?) of those problems.
It's amazing how edge cases can make a simple command such as 'echo' break. (Top tip - use printf instead of echo)
This is why you'll see code like this: echo 'prompt: ' | tr -d '\012'
No other simple mechanism was portable at the time. Seriously portability-minded coders still use that line, because although the issue is finally dead in linux+bash (i.e. /bin/echo is enough like bash's builtin) - it's likely still broken in other Unixen out there.
prinf -- "fmt str here..." "$carefully" "$quoted" "$args"