From owner-freebsd-questions@FreeBSD.ORG Thu Aug 14 10:23:39 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D969F37B401 for ; Thu, 14 Aug 2003 10:23:39 -0700 (PDT) Received: from hermes.pressenter.com (hermes.pressenter.com [69.58.128.19]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9375843FBD for ; Thu, 14 Aug 2003 10:23:35 -0700 (PDT) (envelope-from nospam@hiltonbsd.com) Received: from [69.58.134.109] (helo=daggar.sbgnet.local) by hermes.pressenter.com with smtp (Exim 3.16 #1) id 19nLp0-00028J-00; Thu, 14 Aug 2003 12:23:34 -0500 Date: Thu, 14 Aug 2003 12:23:34 -0500 From: Stephen Hilton To: "Charles Howse" Message-Id: <20030814122334.0a05ab4b.nospam@hiltonbsd.com> In-Reply-To: <003001c36287$2a2a7b40$04fea8c0@moe> References: <20030814115313.2707cb21.nospam@hiltonbsd.com> <003001c36287$2a2a7b40$04fea8c0@moe> X-Mailer: Sylpheed version 0.9.4 (GTK+ 1.2.10; i386-portbld-freebsd4.8) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit cc: freebsd-questions@freebsd.org Subject: Re: Using bc in bash script X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Aug 2003 17:23:40 -0000 On Thu, 14 Aug 2003 12:11:55 -0500 "Charles Howse" wrote: > > Charles, > > > > This will set bc precision to 5 decimal places: > > > > et=`echo "scale=5 ; $end_time - $start_time" | bc` > > Ohhh, I was really hoping on that one...but no, it still reports 0 > seconds. Sorry I jumped the gun there, the scale is needed for this to work but the "date +%s" willonly resolve into whole seconds after reading the date man page. I sure am curious as to how to solve this also, the /usr/bin/time command man page says this: -----------------snip------------------ DESCRIPTION The time utility executes and times the specified utility. After the utility finishes, time writes to the standard error stream, (in seconds): the total time elapsed, the time used to execute the utility process and the time consumed by system overhead. -----------------snip------------------ So that looks like seconds only also. A quick browse through "man sh" and "man bash" look like their builtin time commands also resolve to seconds. Curiousy, Stephen Hilton nospam@hiltonbsd.com