From owner-freebsd-questions@FreeBSD.ORG Thu Aug 14 08:46:54 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 7D01037B401 for ; Thu, 14 Aug 2003 08:46:53 -0700 (PDT) Received: from remt21.cluster1.charter.net (remt21.cluster1.charter.net [209.225.8.31]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3DF4843F85 for ; Thu, 14 Aug 2003 08:46:53 -0700 (PDT) (envelope-from chowse@charter.net) Received: from [66.168.145.25] (HELO moe) by remt21.cluster1.charter.net (CommuniGate Pro SMTP 4.0.6) with ESMTP id 123150611 for freebsd-questions@freebsd.org; Thu, 14 Aug 2003 11:46:52 -0400 From: "Charles Howse" To: Date: Thu, 14 Aug 2003 10:46:45 -0500 Message-ID: <001201c3627b$44047c70$04fea8c0@moe> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2616 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal Subject: 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 15:46:55 -0000 Hello List, I've migrated from Redhat Linux 9 to FreeBSD 4.8-RELEASE, character mode - no gui. I'm trying to calculate the number of seconds between $start_time and $end_time in a bash script. 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 Then I want to: et=`bc $end_time - $start_time` to get the number of seconds or fractions of seconds elapsed. That's not working, bc is printing: file 1085492365 not available >From what I've read in man bc, it's probably assuming those variables are files. I've read man bc, but I'm afraid it's beyond me (makes gesture with hand passing over top of head). What is the proper way to get the elapsed time here? If the answer is in man bc, would someone please be kind enough to point out the section so I can re-read it. Thanks, Charles