#!/bin/sh vol="$(amixer get Master | tail -n1 | sed -r 's/.*\[(.*)%\].*/\1/')" ## if any argument if [ $# -gt 0 ]; then stat="$(amixer get Master | tail -n1 | sed -r 's/.*\[(.*)].*/\1/')" if [[ $(echo $stat) == "on" ]]; then echo " 🔊 $vol" exit fi echo " 🔇 $vol" exit fi ## just returns volume % vol="$(amixer get Master | tail -n1 | sed -r 's/.*\[(.*)%\].*/\1/')" echo -e "$vol"