sexta-feira, 18 de abril de 2008

Shell: Script genérico para controle de players de som



#!/bin/bash
#
# music_control.sh

unset PROGRAM
unset PLAYERS

PLAYERS="xmms.bin amarok audacious"

for PROGRAM in $PLAYERS ;
do
if ps -u $USER | grep $PROGRAM > /dev/null 2>&1 ;
then
break
else
unset PROGRAM
fi
done

[ -z $PROGRAM ] && exit 1

case "$1" in
'--play-pause')
$PROGRAM -t
;;
'--stop')
$PROGRAM -s
;;
'--rew')
$PROGRAM -r
;;
'--fwd')
$PROGRAM -f
;;
*)
echo "Usage: $0 --play-pause | --stop | --rew | --fwd"
exit 1
;;
esac

Nenhum comentário:

Postar um comentário

Drunk Penguins

Drunk Penguins
Drunk Penguins