Only restore set -x option if it was previously set

This commit is contained in:
Alexandre Aubin 2020-09-30 18:43:11 +02:00
parent 9a221a8d0b
commit c94a7614ad

View file

@ -1,8 +1,8 @@
# -*- shell-script -*- # -*- shell-script -*-
readonly XTRACE_ENABLE=$(set +o | grep xtrace) # This is a trick to later only restore set -x if it was set when calling this script
set +x set +x
for helper in $(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null) ; do for helper in $(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null) ; do
[ -r $helper ] && . $helper || true [ -r $helper ] && . $helper || true
done done
set -x eval "$XTRACE_BKP"