Using bc in bash script
Dan Nelson
dnelson at allantgroup.com
Thu Aug 14 11:01:35 PDT 2003
In the last episode (Aug 14), Richard Tobin said:
> > I'm trying to calculate the number of seconds between $start_time and
> > $end_time in a bash script.
>
> Bash has built-in integer arithmetic:
>
> et=$[End_time - Start_time]
Most bourne-based shells have arithmetic evaluation. For portability,
you should use the $(( )) syntax:
/bin/sh
$ echo $(( 1 + 3 ))
4
$
--
Dan Nelson
dnelson at allantgroup.com
More information about the freebsd-questions
mailing list