1 |
On Wed, 1 Sep 2004 21:21:44 +0100 Ciaran McCreesh <ciaranm@g.o> |
2 |
wrote: |
3 |
| Currently, we have something like 200 ebuilds which call 'sleep'. How |
4 |
| would people feel about replacing this with an eutils function called |
5 |
| 'epause' (or 'esleep', or 'ezzz', or esitaroundforabit)? |
6 |
|
7 |
Ok, based upon feedback... |
8 |
|
9 |
# Wait for the supplied number of seconds. If no argument is supplied, |
10 |
# defaults to five seconds. If the EPAUSE_IGNORE env var is set, don't |
11 |
# wait. If we're not outputting to a terminal, don't wait. |
12 |
epause() { |
13 |
if [ -z "$EPAUSE_IGNORE" ] && [ -t 1 ] ; then |
14 |
sleep ${1:-5} |
15 |
fi |
16 |
} |
17 |
|
18 |
# Beep the specified number of times (defaults to five). If our output |
19 |
# is not a terminal, don't beep. If the EBEEP_IGNORE env var is set, |
20 |
# don't beep. |
21 |
ebeep() { |
22 |
local n |
23 |
if [ -z "$EBEEP_IGNORE" ] && [ -t 1 ] ; then |
24 |
for ((n=1 ; n <= ${1:-5} ; n++)) ; do |
25 |
echo -ne "\a" |
26 |
sleep 0.1 &>/dev/null ; sleep 0,1 &>/dev/null |
27 |
echo -ne "\a" |
28 |
sleep 1 |
29 |
done |
30 |
fi |
31 |
} |
32 |
|
33 |
If no-one screams, I'll go ahead with this tomorrow. |
34 |
|
35 |
-- |
36 |
Ciaran McCreesh : Gentoo Developer (Sparc, MIPS, Vim, Fluxbox) |
37 |
Mail : ciaranm at gentoo.org |
38 |
Web : http://dev.gentoo.org/~ciaranm |