Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Say I have files foo-a.wav, foo-b.wav and foo-c.wav on disk.

I have a piece of software whose interface allows me to enter the name of a single sound file; every time a certain feature of that software is activated it loads that file and plays it.

I want to play a random sound every time this feature is activated.

Is there some feature of the Unix filesystem that will let a file access for foo.wav return any of foo-a.wav, foo-b.wav or foo-c.wav at random?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

No. The closest thing you could do would be to write a program to serve up a unix domain socket and change the content it serves each time a client connects.

share|improve this answer
1  
...or a crontab entry to change it every minute, depending if it's allowable to have the same file repeat. –  Nevin Williams May 22 '13 at 18:03
1  
Or, a crontab entry that checks the file's access time every minute, and changes the symlink when it's been accessed. –  Nevin Williams May 22 '13 at 18:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.