Random Sound File (Rated 0)Description:
Pick a sound file at random and play it. Obviously, this could be modified for other files Code starts here
#!/bin/sh
#random-sound.sh: play a random file from the sounds directory
cd $HOME/sounds
filename=$(find -type f |
awk 'BEGIN{
srand()
}
{
names[NR]=$0
}
END{
i=1+int(rand()*NR)
print names[i]
}
')
echo "$filename"
wavplay "$filename"
Submitted by Devscripts on 27-02-2003 20:37 |