Sound on command exit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



	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=" \!$"

	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




[Index of Archives]     [Linux for the Blind]     [Fedora Discussioin]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]
  Powered by Linux