why is printf preferable to echo here other than formatting?
echo Option -n invalid # OK
echo -n is not valid # Uh oh
printf '%s ' -n is not valid # Always okay
Generally you should use printf because of its consistency. For a simpler example of OP's: panic() { printf '%s\n' "${0}: ${*}"; exit 1; }
Is fine. I don't see the need to pass a format string to your function. Just call: panic "${download_url}: unable to download"