added sudo command not existent error handling
This commit is contained in:
parent
eeaee974bd
commit
fd49c9e953
11
pman.sh
11
pman.sh
@ -78,9 +78,14 @@ elif [ "$more_arguments" = "true" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If sudo is needed and necessary (and installed), prepend it
|
# If sudo is needed and necessary (and installed), prepend it, if not installed throw error
|
||||||
if [ "$su_needed" = "true" ] && [ "$UID" != 0 ] && command -v "sudo" &>/dev/null; then
|
if [ "$su_needed" = "true" ] && [ "$UID" != 0 ]; then
|
||||||
sudo $command $command_args "${@}"
|
if command -v "sudo" &>/dev/null; then
|
||||||
|
sudo $command $command_args "${@}"
|
||||||
|
else
|
||||||
|
echo "sudo command needed but not found" > /dev/stderr
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
$command $command_args "${@}"
|
$command $command_args "${@}"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user