diff --git a/pman.sh b/pman.sh index 18e691b..98fe13c 100755 --- a/pman.sh +++ b/pman.sh @@ -1,37 +1,37 @@ #!/usr/bin/env bash # Store the first command line argument in the variable "command" and shift the rest -command="$1" +command_args="$1" shift -# Evaluate the command -if [ "$command" = "search" ]; then +# Evaluate the command arguments +if [ "$command_args" = "search" ]; then command="pacman" command_args="-Ss" -elif [ "$command" = "update" ]; then +elif [ "$command_args" = "update" ]; then command="pacman" command_args="-Sy" su_needed=true -elif [ "$command" = "upgradable" ]; then +elif [ "$command_args" = "upgradable" ]; then command="pacman" command_args="-Qu" -elif [ "$command" = "upgrade" ]; then +elif [ "$command_args" = "upgrade" ]; then command="pacman" command_args="-Syu" su_needed=true -elif [ "$command" = "install" ]; then +elif [ "$command_args" = "install" ]; then command="pacman" command_args="-S" su_needed=true -elif [ "$command" = "provides" ]; then +elif [ "$command_args" = "provides" ]; then command="pacman" command_args="-F" -elif [ "$command" = "config" ]; then +elif [ "$command_args" = "config" ]; then command="nano" command_args="/etc/pacman.conf" su_needed=true else - echo "Invalid command: \"$command\"" + echo "Invalid command: \"$command_args\"" echo echo "Usage: pman [args...]" echo "Available commands:"