[sf-lug] system beep
a_kleider at yahoo.com
Tue Jan 12 11:45:09 PST 2010
Thank you, Akkana, for providing the answer.
running echo $'\a' >/dev/console is the answer I was looking for.
The fact that redirection to /dev/console requires root privileges is a fly in the ointment unfortunately.
In the process of playing with this I've discovered that
sudo echo $'\a' >/dev/console
DOES NOT work! Somehow the sudo seems only to apply to the echo command, not to the redirection to /dev/console.
sudo <script that contains the same (redirected) command> does work
Again, thank you Akkana, for sorting this out for us.
The issue seems to be overshadowed by the fact that on many people's system, the bell doesn't seem to be working.
a_kleider at yahoo.com
--- On Fri, 1/8/10, Akkana Peck <akkana at shallowsky.com> wrote:
> From: Akkana Peck <akkana at shallowsky.com>
> Subject: Re: [sf-lug] system beep
> To: sf-lug at linuxmafia.com
> Date: Friday, January 8, 2010, 10:17 AM
> > On Thu, 2010-01-07 at 17:49
> -0800, Alex Kleider wrote:
> > > if at the linux command line (bash shell) I type
> > > $ echo $'\a'
> > > the bell rings
> jim writes:
> > when i use the command
> > $ echo $'\a'
> Another way is to tell bash to print the beep character
> (ctrl-G, ASCII 7):
> $ echo -e "\007"
> But when I put either one in a script and run it through
> at, the
> problem seems to be that at is redirecting the output, so
> the ctrl-G
> never goes to a terminal that can turn it into sound. Try
> some visible text in your script:
> echo BEEP $'\a'
> and you'll see that you never see the BEEP either if you
> call it
> from at.
> If you explicitly redirect it to a terminal, it works.
> For instance, type tty to find out what your current
> terminal is,
> then put that in the script:
> echo BEEP $'\a' >/dev/pts/1
> and call it from at, and it should work (it did for me).
> But that's not very convenient if you want to schedule a
> script to run
> days fom now, since you'd have to be sure what pty is there
> you can write to.
> If your script can run as root, you could use the console:
> echo $'\a' >/dev/console
> Or if you're pretty sure you'll be logged in on the console
> your own user, you could use tty0 or tty1:
> echo $'\a' >/dev/tty1
> sf-lug mailing list
> sf-lug at linuxmafia.com
> Information about SF-LUG is at http://www.sf-lug.org/
More information about the sf-lug