Using bc in bash script
alexander.haderer at charite.de
Thu Aug 14 09:50:37 PDT 2003
At 11:35 14.08.2003 -0500, Kirk Strauser wrote:
>At 2003-08-14T16:08:21Z, "Charles Howse" <chowse at charter.net> writes:
> > Can I refine it to give me something like: .784 seconds?
>Use "bc -l" instead of bc. That should do it.
Yes, but not in the context mentioned before:
> > > Start_time=`date +%s` # Seconds past midnight at start of script
> > > [ do lots of stuff ]
> > > End_time=`date +%s` # Seconds past midnight at end of script
et=`echo "$end_time - $start_time" | bc -l`
Here bc -l will not really help, because date +%s returns whole seconds :-(
BTW: %s are seconds since epoch
More information about the freebsd-questions