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
   Sound on command exit Victor Tsaran
@  ` Sebastian Taralunga
     ` Janina Sajka
     ` Victor Tsaran
   ` Janina Sajka
  1 sibling, 2 replies; 6+ messages in thread
From: Sebastian Taralunga @  UTC (permalink / raw)
  To: speakup

A simple way to get a beep on exiting a command is:

command; echo ^G

Where ^G is a real ^G and not just the characters ^ followed
by G. That is, in order to use it you have to press ^V
followd by ^G ( ^V tells the shell that a real ^G is
following ).

^G is similar to a beep; if one beep is not enough you can
use a command line like: 

command; echo ^G; sleep 1; echo ^G; sleep 1; echo ^G

which would give you three beeps with one second delay
between them.

You can also use a command like: 

alias f='echo ^G; sleep 1; echo ^G'

in your .profile so that you can alias f to two beeps with
one second delay between them, from now on you can use

command;f

and here it is!

Alternatively you can do is do create a small shell script
(say f) which you should place in one of the paths from your
$PATH; this script whould look like: 

#! /bin/sh 
echo ^G; sleep 1; echo ^G

which does exactely the same thing.

This is the difficult way to accomplish that. 


But from far away the most simple is to use a real ^G in
your $PS1 variable like this:

PS1='\h:\w\$ ^G'

The PS1 variable is the one which tells the shell what to
print as the command prompt. It is usually intialised within
the /etc/profile, and it looks differently for the root or
for the normal user. You can always change the value of this
variable and the changes take effect immediately. You can
change it's value within the .profile if you  want a very
personalised profile. 

Now, on my system which is Slackware, the value of PS1 is
\h:\w\$ which means: the prompt shows me the hostname, the
current working directory and a $; so what I did I change
this and I added a ^G which means that any time I eiher
press enter or exit a command I will hear a beep. 

Please don't hesitate to ask any question if you need, I 
really hope this helps, 

Have a nice day, 

Sebastian
  
On Fri, 14 Apr 2000, Victor Tsaran wrote:

> 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
   Sound on command exit Victor Tsaran
   ` Sebastian Taralunga
@  ` Janina Sajka
  1 sibling, 0 replies; 6+ messages in thread
From: Janina Sajka @  UTC (permalink / raw)
  To: speakup; +Cc: Speakup List

Victor:

This is excellent. But how do we generalize this? What is the correct
syntax to set up our bash (or whatever) environment to automatically
append a '; $sound_command' to whatever command we might type?

I know we can easily customize with aliases. Is that the best solution? It
might be, because that way we could assign a particular sound for a
particular command.

Hmmm. And shouldn't we be able to somehow indicate the console involved
with a variable?

Were I come from, we call these kinds of sounds earcons, by the bye.
On Fri, 14 Apr 2000, Victor Tsaran wrote:

> 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
> 
> 
> 
> _______________________________________________
> Speakup mailing list
> Speakup@braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
> 

-- 

				Janina Sajka, Director
				Information Systems Research & Development
				American Foundation for the Blind (AFB)

janina@afb.net




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

* Re: Sound on command exit
   ` Sebastian Taralunga
@    ` Janina Sajka
     ` Victor Tsaran
  1 sibling, 0 replies; 6+ messages in thread
From: Janina Sajka @  UTC (permalink / raw)
  To: speakup

Sebastian:

I like it! <grin>

So, if I hate plain old boring 1kHz beeps, I could use any .wav, .au,
.mp3, etc., right?

For example, I have a duel boot system that doesn't boot much anymore --
but that's another story. The point of the story I'm telling is that my
Windows files are on a partition on my system. So, I can issue a command,
or modify my PS with something like:

; aplay /win98/windows/media/asterisk.wav

Only problem seems to be that I'm not surpressing the copyright/authorship
info of aplay--and that's annoying.

Hmmm. For something really spooky, try:

; aplay /win98/windows/media/"The Microsoft Sound.wav"


On Sat, 15 Apr 2000, Sebastian Taralunga wrote:

> 
> A simple way to get a beep on exiting a command is:
> 
> command; echo ^G
> 
> Where ^G is a real ^G and not just the characters ^ followed
> by G. That is, in order to use it you have to press ^V
> followd by ^G ( ^V tells the shell that a real ^G is
> following ).
> 
> ^G is similar to a beep; if one beep is not enough you can
> use a command line like: 
> 
> command; echo ^G; sleep 1; echo ^G; sleep 1; echo ^G
> 
> which would give you three beeps with one second delay
> between them.
> 
> You can also use a command like: 
> 
> alias f='echo ^G; sleep 1; echo ^G'
> 
> in your .profile so that you can alias f to two beeps with
> one second delay between them, from now on you can use
> 
> command;f
> 
> and here it is!
> 
> Alternatively you can do is do create a small shell script
> (say f) which you should place in one of the paths from your
> $PATH; this script whould look like: 
> 
> #! /bin/sh 
> echo ^G; sleep 1; echo ^G
> 
> which does exactely the same thing.
> 
> This is the difficult way to accomplish that. 
> 
> 
> But from far away the most simple is to use a real ^G in
> your $PS1 variable like this:
> 
> PS1='\h:\w\$ ^G'
> 
> The PS1 variable is the one which tells the shell what to
> print as the command prompt. It is usually intialised within
> the /etc/profile, and it looks differently for the root or
> for the normal user. You can always change the value of this
> variable and the changes take effect immediately. You can
> change it's value within the .profile if you  want a very
> personalised profile. 
> 
> Now, on my system which is Slackware, the value of PS1 is
> \h:\w\$ which means: the prompt shows me the hostname, the
> current working directory and a $; so what I did I change
> this and I added a ^G which means that any time I eiher
> press enter or exit a command I will hear a beep. 
> 
> Please don't hesitate to ask any question if you need, I 
> really hope this helps, 
> 
> Have a nice day, 
> 
> Sebastian
>   
> On Fri, 14 Apr 2000, Victor Tsaran wrote:
> 
> > 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
> 
> 
> _______________________________________________
> Speakup mailing list
> Speakup@braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
> 

-- 

				Janina Sajka, Director
				Information Systems Research & Development
				American Foundation for the Blind (AFB)

janina@afb.net




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

* Re: Sound on command exit
   ` Sebastian Taralunga
     ` Janina Sajka
@    ` Victor Tsaran
  1 sibling, 0 replies; 6+ messages in thread
From: Victor Tsaran @  UTC (permalink / raw)
  To: speakup

Sebo, wonderful!
thanks for the tip,
Vic

----- Original Message -----
From: "Sebastian Taralunga" <seba@tcx.ro>
To: <speakup@braille.uwo.ca>
Sent: Saturday, April 15, 2000 2:29 AM
Subject: Re: Sound on command exit


>
> A simple way to get a beep on exiting a command is:
>
> command; echo ^G
>
> Where ^G is a real ^G and not just the characters ^ followed
> by G. That is, in order to use it you have to press ^V
> followd by ^G ( ^V tells the shell that a real ^G is
> following ).
>
> ^G is similar to a beep; if one beep is not enough you can
> use a command line like:
>
> command; echo ^G; sleep 1; echo ^G; sleep 1; echo ^G
>
> which would give you three beeps with one second delay
> between them.
>
> You can also use a command like:
>
> alias f='echo ^G; sleep 1; echo ^G'
>
> in your .profile so that you can alias f to two beeps with
> one second delay between them, from now on you can use
>
> command;f
>
> and here it is!
>
> Alternatively you can do is do create a small shell script
> (say f) which you should place in one of the paths from your
> $PATH; this script whould look like:
>
> #! /bin/sh
> echo ^G; sleep 1; echo ^G
>
> which does exactely the same thing.
>
> This is the difficult way to accomplish that.
>
>
> But from far away the most simple is to use a real ^G in
> your $PS1 variable like this:
>
> PS1='\h:\w\$ ^G'
>
> The PS1 variable is the one which tells the shell what to
> print as the command prompt. It is usually intialised within
> the /etc/profile, and it looks differently for the root or
> for the normal user. You can always change the value of this
> variable and the changes take effect immediately. You can
> change it's value within the .profile if you  want a very
> personalised profile.
>
> Now, on my system which is Slackware, the value of PS1 is
> \h:\w\$ which means: the prompt shows me the hostname, the
> current working directory and a $; so what I did I change
> this and I added a ^G which means that any time I eiher
> press enter or exit a command I will hear a beep.
>
> Please don't hesitate to ask any question if you need, I
> really hope this helps,
>
> Have a nice day,
>
> Sebastian
>
> On Fri, 14 Apr 2000, Victor Tsaran wrote:
>
> > 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
>
>
> _______________________________________________
> Speakup mailing list
> Speakup@braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup



^ 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).