public inbox for speakup@linux-speakup.org
 help / color / mirror / Atom feed
* Sound on command exit
@  Victor Tsaran
   ` Sebastian Taralunga
   ` Janina Sajka
  0 siblings, 2 replies; 6+ messages in thread
From: Victor Tsaran @  UTC (permalink / raw)
  To: Speakup List

Hello, listers!
Some of you have asked previously whether it is possible to have some sort
of beep after certain command exits or certain task terminates. Yesterday I
was playing around with Linux with another friend of mine, Luke Davis, who
is yet another Linux user from Philadelphia. Accidentally, we recalled that
Unix allows one to specify several commands on a single command line by
dividing these commands with a semicolon. So, for instance, to run pine
after your lynx exits you could enter:

lynx; pine <ENTER>

The Pine would fire up as soon as you quit Lynx. that opens a lot of
interesting possibilities for providing temporary sound solutions to
indicate termination of a background task or any other event. You could
either run `play' command with your beloved .wav file on the command line or
you could create a very short script called beep and exploit it.
Say, we have a file called beep_when_you_re_done.wav and you'd like to know
when your kernel finishes compiling. You might enter:

make bzImage output.txt 2>&1 &; play beep_when_you_re_done.wav

Now you can safely switch to another console and do other things. When "make
bzImage" is finished, it will play the file.

Hope this can help someone.
Regards,
Victor




^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: Sound on command exit
@  Martin G. McCormick
  0 siblings, 0 replies; 6+ messages in thread
From: Martin G. McCormick @  UTC (permalink / raw)
  To: speakup

	To hear a sound at the end of a command is very useful.  I
think I have been doing that for about ten years, now.  I just did a
bit of research and found that I can make it happen in bash although
it will depend upon what your terminal or console does when it
receives a Bell character which is usually a Control-G.  I have always
used the C-shell or /bin/csh on the Sun I use at work so I just tried
to see what I could do in bash which is actually a better shell in
many ways.  Old habits die hard.

	Here's what you need to do.

	Edit your .profile file in your login directory and add the
following line:

PS1=" \a\!$"

	Here's the translation.  PS1 is the environmental variable
that bash looks at to see what the primary prompt string looks like.
All the characters in this string are printable except for the Bell
character which is a Control-G.  You need the backslash in front of
the ! so that it will be interpreted as the variable and not just
printed as part of the prompt.  The $ or Dollar Sign can be left out
if you like.  It is just the usual bash prompt.

	I suggest you read the bash manual where the PS1 variable is
discussed for more information.

	If your terminal beeps upon receipt of the Control-G, you are
in business to hear a sound after every command.  This does not work
after invoking a bash shell from some other shell.

Martin McCormick


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~ UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
 Sound on command exit Victor Tsaran
 ` Sebastian Taralunga
   ` Janina Sajka
   ` Victor Tsaran
 ` Janina Sajka
 Martin G. McCormick

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).