#!/usr/bin/env sh ${SPEAKER:-"Line Out"} ${HEADPHONE:-"Headphone"} ${EARPIECE:-"Earpiece"} audiodevice() { amixer sget "$EARPIECE" | grep -qE '\[on\]' && echo "$EARPIECE" && return amixer sget "$HEADPHONE" | grep -qE '\[on\]' && echo "$HEADPHONE" && return amixer sget "$SPEAKER" | grep -qE '\[on\]' && echo "$SPEAKER" && return echo "None" } audiodevice