🟢 cat ~/bin/volume.sh #!/bin/bash # Check if the argument is provided if [ $# -ne 1 ]; then echo "Usage: $0 [plus|minus]" exit 1 fi # Define the mixer action based on the argument action="$1" # Array of potential mixer numbers mixer_numbers=("0" "1" "2" "3") # Adjust the list as needed # Loop through potential mixer numbers until a valid one is found for num in "${mixer_numbers[@]}"; do if [ "$action" = "plus" ]; then amixer -c "$num" set Master 5%+ &>/dev/null elif [ "$action" = "minus" ]; then amixer -c "$num" set Master 5%- &>/dev/null else echo "Invalid action: $action (Use 'plus' or 'minus')" exit 1 fi if [ $? -eq 0 ]; then exit 0 fi done # If no valid mixer number is found, print an error message echo "Failed to find a valid mixer control" >&2