Meta: Do not ignore error message with exec

When calling sub-programs from shell with exec, the useful || die
idiom does not actually do anything, since the first script is gone.
This commit is contained in:
Chris Frey 2021-12-11 20:55:03 -05:00 committed by Brian Gianforcaro
parent 8e935ad3b1
commit 319cdf4ff3
Notes: sideshowbarker 2024-07-17 21:16:31 +09:00

View file

@ -8,7 +8,8 @@ die() {
}
if [ "$(id -u)" != 0 ]; then
exec sudo -E -- "$0" "$@" || die "this script needs to run as root"
sudo -E -- "$0" "$@" || die "this script needs to run as root"
exit 0
else
: "${SUDO_UID:=0}" "${SUDO_GID:=0}"
fi