Date: Thu, 14 Aug 2003 10:46:45 -0500 From: "Charles Howse" <chowse@charter.net> To: <freebsd-questions@freebsd.org> Subject: Using bc in bash script Message-ID: <001201c3627b$44047c70$04fea8c0@moe>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?001201c3627b$44047c70$04fea8c0>