Pro-protip: don't use echo.
# panic STRING-FORMAT [...]
#
# write printf-formatted message to stderr, prepending
# script name, and exit failure
panic() {
printf "%s: %.0s${1}\n" "${0##*/}" "$@" >&2
exit 1
}
Prepending the script name is immensely helpful when diagnostic messages are mixed on stderr. It's also standard style for Unix utilities in general. The BSD extensions err(3) and warn(3), provided by all modern Unix libc implementations and commonly use by shell utilities, prepend the program name.
Another common style guideline is to include context for the diagnostic, often prepended. For example,
wget --quiet --output-document /usr/local/bin/mybinary "$download_url" \
|| panic '%s: unable to download' "$download_url"