Date: Thu, 14 Aug 2003 13:01:26 -0500 From: Dan Nelson <dnelson@allantgroup.com> To: Richard Tobin <richard@cogsci.ed.ac.uk> Cc: freebsd-questions@freebsd.org Subject: Re: Using bc in bash script Message-ID: <20030814180126.GB33379@dan.emsphone.com> In-Reply-To: <200308141742.SAA17915@rhymer.cogsci.ed.ac.uk> References: <200308141742.SAA17915@rhymer.cogsci.ed.ac.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
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@allantgroup.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030814180126.GB33379>