Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Aug 2003 13:35:59 -0500
From:      "Charles Howse" <chowse@charter.net>
To:        <freebsd-questions@freebsd.org>
Subject:   RE: Using bc in bash script
Message-ID:  <000201c36292$e83d13d0$04fea8c0@moe>
In-Reply-To: <20030814125801.11b0c2d2.nospam@hiltonbsd.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> > > Sorry I jumped the gun there, the scale is needed for 
> this to work 

Not a problem, thanks for working with me!

> > The precision is in hundredths of a second as I understand it from
> > playing with time(!):
> > 
> > #!/bin/sh
> > time_file=tmp.time
> > time="time -a -o $time_file"
> > $time cat /var/log/messages >/dev/null 2>&1
> > $time cat /var/log/maillog >/dev/null 2>&1
> > awk '{sum+=$1}END{print sum}' $time_file
> > rm $time_file
> > 
> > which outputs:
> > 
> > [18:34:03] munk@users /home/munk# sh tmp.sh
> > 0.01
> > 
> > This simple script just times each cat command and appends 
> the output from
> > time to the $time_file, then prints out the sum of the 
> first columns of
> > the time outputs found in the time file. 
> > 
> > Just an idea.
> > -- 
> 
> Jez,
> 
> Your shell script works fine for me, resolving to 100th's of a second.
> 
> Looks like a good answer for Charles :-)
> 
> I still am wondering why the date command does not have a format 
> string for seconds (down to 100th's) like "+%ss" and also why 
> the time command stops at 100th's when other programs resolve 
> time to 5 or 6 decimal places ?
> 
> Thanks for sharing the info,

Yes, thanks very much!
I'll try that as soon as I finish my break from hanging window blinds
for my daughter. (ick!)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000201c36292$e83d13d0$04fea8c0>