by spbnick · 12y ago · 0 comments
E.g. when a function receives less arguments than necessary and you retrieve them like this:
function f()
{
declare -r x="$1"; shift
declare -r y="$1"; shift
declare -r z="$1"; shift
}
with less than three arguments passed and shift_verbose on you will get an
error message the moment you shift and with "set -e" in addition, execution
will be aborted.See https://www.gnu.org/software/bash/manual/html_node/The-Shopt...
Also, "set -o noclobber" might be useful. If you try to redirect to an existing file with ">", it will fail. If you explicitly want to overwrite the file without triggering the error, use ">|".
See https://www.gnu.org/software/bash/manual/html_node/Redirecti...
No comments yet.