Using bc in bash script

Alexander Haderer alexander.haderer at
Thu Aug 14 09:55:05 PDT 2003

At 11:45 14.08.2003 -0500, Charles Howse wrote:
> > > Can I refine it to give me something like: .784 seconds?
> >
> > Use "bc -l" instead of bc.  That should do it.
>No, that still gives 0 seconds.
>I think this whole thing is dependent on the fact that `date +%s`
>reports integers.
>I'm still interested in something like .874 seconds, but for the time
>being, I'll just use an if..then..else to say "less than 1 second" or
>the actual number of seconds.
>I've looked at the time command suggested by Jez, haven't tried it yet.

Note the trap: shell's builtin "time" command differs somewhat from 
installed "/usr/bin/time"!

man time
man builtin
man <your_shell>


More information about the freebsd-questions mailing list