Bell sound alert on bash shell giving me the prompt
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Bell sound alert on bash shell giving me the prompt
Hello,
I'm a user of bash and I'd like to set it up so that it rings the bell every time a command terminates, successfully or not, and hands me the prompt again.
This would wake me up :-) And I would not have to stare at the screen, ruining my eyes.
Think of all of us who could then close their eye lids for some 3 to 30 seconds, rest their eye sight and brain...
Any way this very usefull little utility can be done ?
should ring the bell, however the caveat is that the bell must be enabled and if it is not all you will see is a blank newline and then your prompt.
Test it beforehand:
your prompt % echo -e "\a" and smash enter
If all you get is a space the bell is disabled, non-existent or broken. I am certain you could figure out some other way to alert yourself when a process has finished using a script. This is for you to discover.
There are more than a million hits on any search engine resolving the bell ringing issue.
An alternative would be to use a process that sends a message to every terminal and interrupts what you are doing there. Perhaps you should try a script to schedule these long processes and forget them until later, that is what computers are really good at, doing stuff by themselves.
but it rings the bell on every return key strike :-)
I guess for now I'll put this aside and try to come up with a solution that would ring the bell only when scripts taking more than 3 seconds terminate.
That'd be nice.
Last edited by stephaneeybert; 01-29-2012 at 03:40 PM.
This is an old thread but just stumbled on it while looking up the meta for a system sound. I've answered here for whoever else needs to know and finds this page.
Chain the echo command whenever you want the alert (with a command you think might last awhile):
Code:
$sleep 4; echo -e "\007"
That way, the sound command doesn't start until the previous finishes.
You can also shorten the echo part to just a z (for sleep) with an alias by adding something like this to your .bash_profile
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.