4 ms·
Echo is defined differently in different shells ("not portable"). Also it can have arguments which breaks things sometimes: echo Option -n invalid # OK
by stonewareslord 6y ago
Echo is defined differently in different shells ("not portable"). Also it can have arguments which breaks things sometimes:
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"