29 lines
801 B
Bash
Executable File
29 lines
801 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# USB Insert / Remove sound script
|
|
# Created by om3ganet (msn@om3ga.net)
|
|
# --------------------------------------------------
|
|
# This script could probably be cleaned up, and add checking
|
|
# of unrecognised usb sounds (and play fail noise)
|
|
|
|
# change this if you want sounds elsewhere
|
|
SNDDIR=~/Sounds/;
|
|
# check frequency (default 0.25 seconds)
|
|
CHECKFREQ=0.25
|
|
|
|
|
|
# Do not edit below this line
|
|
# --------------------------------------------------
|
|
DEVCOUNT=`lsusb | wc -l | awk '{ print $1 }'`
|
|
OLDDEVCOUNT=$DEVCOUNT;
|
|
|
|
while(true) do
|
|
sleep $CHECKFREQ;
|
|
DEVCOUNT=`lsusb | wc -l | awk '{ print $1 }'`
|
|
if [ $DEVCOUNT -gt $OLDDEVCOUNT ]; then
|
|
play `echo $SNDDIR`devinsert.wav;
|
|
elif [ $DEVCOUNT -lt $OLDDEVCOUNT ]; then
|
|
play `echo $SNDDIR`devremove.wav;
|
|
fi
|
|
OLDDEVCOUNT=$DEVCOUNT;
|
|
done |