back

by Jimmc414·4y ago·view on hn ↗
>the find command containing undefined variables was executed and deleted the files

Just a note that "set -u" at the beginning of a bash script will cause it to throw an error for undefined variables. warning that of course this should be tested as it will also cause [[ $var ]] to fail.

If that's the case

[ -z "${VAR:-}" ] && echo "VAR is not set or is empty" || echo "VAR is set to $VAR"

will help test that condition