#!/bin/bash # play the sound files specified. #function lifted from yeti/shells/functions.h # locates a process given a search pattern to match in the process list. function psfind { PID_DUMP=$TMP/pidlist.$RANDOM$RANDOM /bin/ps wuax >$PID_DUMP # remove the first line of the file, search for the pattern the # user wants to find, and just pluck the process ids out of the # results. PIDS_SOUGHT=`cat $PID_DUMP \ | sed -e '1d' \ | grep -i "$1" \ | sed -e 's/^[-a-zA-Z_0-9][-a-zA-Z_0-9]* *\([0-9][0-9]*\).*$/\1/' ` if [ ! -z "$PIDS_SOUGHT" ]; then echo "$PIDS_SOUGHT"; fi /bin/rm $PID_DUMP } if [ $# -lt 1 ]; then #echo no sound file specified. exit 0; fi export PLAYCMD=/usr/bin/play if [ ! -f "$PLAYCMD" ]; then PLAYCMD=echo fi if [ ! -z "`psfind artsd`" ]; then # we see artsd running... PLAYCMD=artsplay elif [ ! -z "`psfind esd`" ]; then # we see esd running... PLAYCMD=esdplay elif [ ! -z "$WINDIR" ]; then # kludge for win32; we provide our own sound player. PLAYCMD=playsound fi # play the sounds individually; playsound can handle multiple files, but # "play" doesn't want to on some systems. for i in $*; do $PLAYCMD $i; done exit 0