1 |
On Wed, 01 Sep 2004 13:49:30 -0700 Seemant Kulleen <seemant@g.o> |
2 |
wrote: |
3 |
| That's a great idea. Along these lines, perhaps something |
4 |
| standardised for the beeping einfo's would be nice too. I know at |
5 |
| least three packages which make use of the beeping einfo messages |
6 |
| (portage, gaim and xorg-x11) -- it'd be nice to make it a function |
7 |
| rather than the stuff that's happening now. |
8 |
|
9 |
Ok, how's this look? |
10 |
|
11 |
# Beep the specified number of times (defaults to five). If our output |
12 |
# is not a terminal, or if seq (part of coreutils) is unavailable, don't |
13 |
# beep. |
14 |
ebeep() { |
15 |
local n |
16 |
if [ -t 1 ] && [ -x /bin/seq ] ; then |
17 |
for n in $(seq 1 ${1:-5}) ; do |
18 |
echo -ne "\a" |
19 |
sleep 0.1 &>/dev/null ; sleep 0,1 &>/dev/null |
20 |
echo -ne "\a" |
21 |
sleep 1 |
22 |
done |
23 |
fi |
24 |
} |
25 |
|
26 |
I think this might not work on OSX, not sure that they have a seq |
27 |
available (although they should...). |
28 |
|
29 |
-- |
30 |
Ciaran McCreesh : Gentoo Developer (Sparc, MIPS, Vim, Fluxbox) |
31 |
Mail : ciaranm at gentoo.org |
32 |
Web : http://dev.gentoo.org/~ciaranm |