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