All pastes #948745 Raw Edit

Zeug

public shellscript v1 · immutable
·published 2008-03-19 12:21 UTC
rendered paste body
#!/bin/bash# config vars - set them appropriate to your system specsNUM="2" #find with: amixer controlsDEVICE="Master Playback" #just call amixerSTANDARDVOLUME="80%" #you can also use dB valuesAMIXER=amixerAUDIOPLAY=aplay #any other audioplayer should do the job, tooAUDIOFILE=~/hae.wav################# don't change anything below here ##############################check whether we get the volume from commandlineif [ $# -eq 1 ]then    VOLUME=$1else    VOLUME=${STANDARDVOLUME}fi#get the current volumeOLD_VOLUME=$(amixer cget numid=$NUM | grep :)OLD_VOLUME=${OLD_VOLUME#*=}#set the desired volume${AMIXER} sset $DEVICE $VOLUME &> /dev/null#play the audiofile${AUDIOPLAY} ${AUDIOFILE} &> /dev/null#restore the old volume${AMIXER} sset $DEVICE $OLD_VOLUME &> /dev/null