5 ms·
I feel your first example is better written like this: if ! ansible-playbook ... ; then echo -e "\e[1;31m""Error when executing ansible!""\e[0m"
by Ded7xSEoPKYNsDd 10y ago
I feel your first example is better written like this:
if ! ansible-playbook ... ; then
echo -e "\e[1;31m""Error when executing ansible!""\e[0m"
exit 1
fi
But generally when I need to work around errexit, I tend to add something like " || true" or " || xyz_failed=true" to the end of the command line instead of turning it off and on again.