diff --git a/pman.sh b/pman.sh index ecc6a70..7b0b01b 100755 --- a/pman.sh +++ b/pman.sh @@ -84,11 +84,12 @@ fi # 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 "${@}" + command="sudo $command" else echo "sudo command needed but not found" > /dev/stderr exit 1 fi -else - $command $command_args "${@}" fi + +# Execute the command +$command $command_args "${@}"