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.

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.

share|improve this question

1 Answer 1

up vote 2 down vote accepted
./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.

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

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.