Hey! Did you see what Richard Adams wrote on May 10 ?
RA> > to turn the timer off, with the line...
RA> > echo -n "+"$TIME_ELAPSED >> /etc/ppp/logs/prog-tot
RA> > This file starts life with "0" in it.
RA> >
RA> > The problem is with "-n" in the echo line, bc doesn't like it at
RA> > all (gives a parse error because there is no end of line character). So
RA> > if I initialized prog-tot with echo "0" > prog-tot (no -n) and then
RA> > _inserted_ $TIME_ELAPSED"+" before the "0" instead of _appending_
RA> > "+"$TIME_ELAPSED after it everything would be honky-dory. But how???
RA>
RA> Would not;
RA> echo -e "+\n"$TIME_ELAPSED >> /etc/ppp/logs/prog-tot
RA> help. ??
Sorry Richard, this doesn't work... it generates the wrong type of
output to prog-tot. It gives:
0
+
n
+
n
And what I need is:
0+n+n+n
RA> Or if i am not seeing the point you could try.
RA> echo "+" ; $TIME_ELAPSED >> /etc/ppp/logs/prog-tot
RA> echo -e "+\n" ; $TIME_ELAPSED >> /etc/ppp/logs/prog-tot
Neither of these work for two reasons. First it sort of gives the
same type of output as your first suggestion. And second because the
semi-colon tells bash that $TIME_ELAPSED is another command to execute.
$TIME_ELAPSED isn't a command its a variable that contains a number.
RA> There are man more combinations to use as well.
I found something that worked!! I just added the following two
lines to the start of the script that tests the total time for the
month...
cat /etc/ppp/logs/prog-tot > /tmp/test-tot
echo -e "\n" >> /tmp/test-tot
Then I use...
TIMES_UP=$(bc -q /tmp/test-tot < /etc/ppp/logs/q)
Thanks for your help Richard, it got me thinking about the problem in a
slightly different way and I was able to solve it by "thinking outside the
box".
BTW, if anyone would like a way for timing how long they spend on
the internet (via dial-up ppp) let me know and I'll send you my scripts.
Regards, Steve Youngs <[EMAIL PROTECTED]> ICQ: 34307457
----------------------------------------------------------
| __ |
|Isn't it good to know that / / __ ___ __ ____ __|
|There _IS_ an alternative! / /__ / // _ \/ // /\ \/ /|
| /____//_//_//_/\_,_/ /_/\_\|
----------------------------------------------------------