diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/volume | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -1,8 +1,13 @@ #!/bin/bash -volumes=$(amixer get Master |grep % |awk '{print $5}'|sed 's/[^0-9]//g') -#avg=$(awk '{ print ($1+$2)/2 }' <(echo $volumes)) -if [[ $1 == 'L' ]]; then - echo "$(echo $volumes | cut -d' ' -f1)%" -else - echo "$(echo $volumes | cut -d' ' -f2)%" -fi +outputs=(Left Right) +i=1 +for o in ${outputs[@]}; do + vol=$(amixer get Master |grep "$o" |grep %) + if [[ "$vol" == *"off"* ]]; then + volumes[$i]="M" + else + volumes[$i]=$(echo $vol |awk '{print $5}'|sed 's/[^0-9%]//g') + fi + let i=i+1 +done +echo ${volumes[*]} |