1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/bin/sh # Display volume level (requires amixer/alsa) if ! command -v amixer >/dev/null 2>&1; then printf "N/A" exit 0 fi amixer get Master 2>/dev/null | awk -F'[][]' '/Playback.*%/ { vol = $2 mute = $4 if (mute == "off") { printf "VOL MUTE" } else { printf "VOL %s", vol } exit }'