From 8d8893842467087dc094351fad3d88827c91b0b3 Mon Sep 17 00:00:00 2001 From: Karma Riuk Date: Sun, 28 Feb 2021 07:35:23 +0100 Subject: [PATCH] Set the cmds in the functions to local variables --- volumectl | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/volumectl b/volumectl index 23a3c55..abe4a12 100755 --- a/volumectl +++ b/volumectl @@ -34,7 +34,7 @@ volume_up_by () { } volume_down_by () { - cmd="$VOLUME_CONTROLLER ${ADDITIONAL_FLAGS[@]} $DECREASE_FLAG $1" + local cmd="$VOLUME_CONTROLLER ${ADDITIONAL_FLAGS[@]} $DECREASE_FLAG $1" [[ $VERBOSE -eq 1 ]] && echo "Decreasing volume by $1, with \`$cmd\`" [[ $VERBOSE -eq 1 ]] && echo "Volume before command: $(get_volume)" @@ -43,7 +43,7 @@ volume_down_by () { } volume_set () { - cmd="$VOLUME_CONTROLLER ${ADDITIONAL_FLAGS[@]} $SET_VOLUME_FLAG $1" + local cmd="$VOLUME_CONTROLLER ${ADDITIONAL_FLAGS[@]} $SET_VOLUME_FLAG $1" [[ $VERBOSE -eq 1 ]] && echo "Setting the volume to $1, with \`$cmd\`" [[ $VERBOSE -eq 1 ]] && echo "Volume before command: $(get_volume)" @@ -52,31 +52,31 @@ volume_set () { } volume_big_up () { - cmd="volume_up_by $BIG_DELTA" + local cmd="volume_up_by $BIG_DELTA" [[ $VERBOSE -eq 1 ]] && echo "Increasing the volume alot, with \`$cmd\`" $cmd } volume_big_down () { - cmd="volume_down_by $BIG_DELTA" + local cmd="volume_down_by $BIG_DELTA" [[ $VERBOSE -eq 1 ]] && echo "Decreasing the volume alot, with \`$cmd\`" $cmd } volume_up () { - cmd="volume_up_by $NORMAL_DELTA" + local cmd="volume_up_by $NORMAL_DELTA" [[ $VERBOSE -eq 1 ]] && echo "Increasing the volume, with \`$cmd\`" $cmd } volume_down () { - cmd="volume_down_by $NORMAL_DELTA" + local cmd="volume_down_by $NORMAL_DELTA" [[ $VERBOSE -eq 1 ]] && echo "Decreasing the volume, with \`$cmd\`" $cmd } toggle_mute() { - cmd="$VOLUME_CONTROLLER $TOGGLE_MUTE_FLAG" + local cmd="$VOLUME_CONTROLLER $TOGGLE_MUTE_FLAG" [[ $VERBOSE -eq 1 ]] && echo "Toggling the mute, with \`$cmd\`" [[ $VERBOSE -eq 1 ]] && echo "Mute state before command: $(get_mute)" @@ -86,7 +86,7 @@ toggle_mute() { mute () { - cmd="$VOLUME_CONTROLLER $SET_UNMUTE_FLAG" + local cmd="$VOLUME_CONTROLLER $SET_UNMUTE_FLAG" [[ $VERBOSE -eq 1 ]] && echo "Setting the mute on, with \`$cmd\`" [[ $VERBOSE -eq 1 ]] && echo "Mute state before command: $(get_mute)" @@ -95,7 +95,7 @@ mute () { } unmute () { - cmd="$VOLUME_CONTROLLER $SET_MUTE_FLAG" + local cmd="$VOLUME_CONTROLLER $SET_MUTE_FLAG" [[ $VERBOSE -eq 1 ]] && echo "Setting the mute off, with \`$cmd\`" [[ $VERBOSE -eq 1 ]] && echo "Mute state before command: $(get_mute)" @@ -219,3 +219,4 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then #if '__name__' == '__main__' ;; esac fi +