moved from $command/sudo $command to include "sudo" in the command variable

This commit is contained in:
Bryan Joshua Pedini 2024-06-10 06:47:32 +02:00
parent cdc17a329b
commit 3e22f4ebbd

View File

@ -84,11 +84,12 @@ fi
# If sudo is needed and necessary (and installed), prepend it, if not installed throw error # If sudo is needed and necessary (and installed), prepend it, if not installed throw error
if [ "$su_needed" = "true" ] && [ "$UID" != 0 ]; then if [ "$su_needed" = "true" ] && [ "$UID" != 0 ]; then
if command -v "sudo" &>/dev/null; then if command -v "sudo" &>/dev/null; then
sudo $command $command_args "${@}" command="sudo $command"
else else
echo "sudo command needed but not found" > /dev/stderr echo "sudo command needed but not found" > /dev/stderr
exit 1 exit 1
fi fi
else
$command $command_args "${@}"
fi fi
# Execute the command
$command $command_args "${@}"