3

Is there an utility which takes a command as argument, runs it and plays sound (or just beeps) depending on the return status? "Good" beep if it's success and "bad" beep if it's failure.

So I can run compiler and take a nap while it builds. And if it will be successful sound, I won't worry.

The question is asked in funny manner, but I really need this tool. I'll have to write my own if there isn't one existing.

1 Answer 1

2
./my_compile_command; if [ $? -eq 0 ]; then mpg123 "VanHalen_1984_02_Jump.mp3"; else mpg123 "SpiceGirls_Spice_1_Wannabe.mp3"; fi

Something like that should work. Of course you will need mpg123 working.

4
  • I should point out that this assumes that your compiler exits with a status of 0 when it is successful.
    – Kirk
    Jun 17, 2011 at 19:37
  • Thanks Kirk, that's is what I need. My compiler does this thing.
    – modular
    Jun 17, 2011 at 21:40
  • @Peth absolutely correct. Old habits die hard as they say.
    – Kirk
    Jun 18, 2011 at 14:45
  • But $? is useful thing. I do exit $? in my script to simulate behavior of the original program.
    – modular
    Jun 19, 2011 at 9:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .