and I like using list constructs (&& ||) in lieu of simple `if` test blocks but it's really important to remember that list constructs aren't exactly the same. This always catches me out:
if [ -e "missingfile" ]
then
echo "you'll never see this"
fi
(above runs fine with set -e)
[ -e "missingfile" ] && echo "you'll never see this"
(while that one correctly fails and thus `set -e` fails the script)
I generally stick an `|| true` on the end of those list constructs.
Comments
These are generally good tips. I swear by
and I like using list constructs (&& ||) in lieu of simple `if` test blocks but it's really important to remember that list constructs aren't exactly the same. This always catches me out: (above runs fine with set -e) (while that one correctly fails and thus `set -e` fails the script)I generally stick an `|| true` on the end of those list constructs.
fwiw.