On Thu, Aug 14, 2003 at 10:46:45AM -0500, Charles Howse wrote:
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
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]
-- Richard
___
[EMAIL PROTECTED] mailing list
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.
Maybe there's something in the script itself that's messing this up.
Here is the entire script:
On Thu, Aug 14, 2003 at 11:08:21AM -0500, Charles Howse wrote:
On Thu, Aug 14, 2003 at 10:46:45AM -0500, Charles Howse wrote:
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
At 2003-08-14T16:45:56Z, Charles Howse [EMAIL PROTECTED] writes:
I think this whole thing is dependent on the fact that `date +%s` reports
integers.
As his daughter says, DUUUH! I only saw the $end_time and $start_time
variables, and not their origins. I'll go back to lurking now. :)
--
On Thu, Aug 14, 2003 at 12:58:01PM -0500 or thereabouts, Stephen Hilton wrote:
On Thu, 14 Aug 2003 18:34:25 +0100
Jez Hancock [EMAIL PROTECTED] wrote:
On Thu, Aug 14, 2003 at 12:23:34PM -0500, Stephen Hilton wrote:
On Thu, 14 Aug 2003 12:11:55 -0500
Charles Howse [EMAIL PROTECTED]
On Thu, 14 Aug 2003 12:11:55 -0500
Charles Howse [EMAIL PROTECTED] 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
At 2003-08-14T16:08:21Z, Charles Howse [EMAIL PROTECTED] writes:
Can I refine it to give me something like: .784 seconds?
Use bc -l instead of bc. That should do it.
--
Kirk Strauser
pgp0.pgp
Description: PGP signature
The precision is in hundredths of a second as I understand it from
playing with time(!):
#!/bin/sh
time_file=tmp.time
time=time -a -o $time_file
$time cat /var/log/messages /dev/null 21
$time cat /var/log/maillog /dev/null 21
awk '{sum+=$1}END{print sum}' $time_file
rm
On Thu, Aug 14, 2003 at 10:46:45AM -0500, Charles Howse wrote:
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` #
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
I received this msg a short time ago:
Antigen for Exchange found daily_report.sh matching =*.sh file filter.
The file is currently Removed. The message, RE: Using bc in bash
script,
was
sent from Charles Howse and was discovered in IMC Queues\Inbound
located at mcglinchey/NewOrleans/NOLA.
I
Sorry I jumped the gun there, the scale is needed for
this to work
Not a problem, thanks for working with me!
The precision is in hundredths of a second as I understand it from
playing with time(!):
#!/bin/sh
time_file=tmp.time
time=time -a -o $time_file
$time cat
At 2003-08-14T17:58:01Z, Stephen Hilton [EMAIL PROTECTED] writes:
I still am wondering why the date command does not have a format string
for seconds (down to 100th's) like +%ss and also why the time command
stops at 100th's when other programs resolve time to 5 or 6 decimal places?
My guess
At 11:45 14.08.2003 -0500, Charles Howse wrote:
Can I refine it to give me something like: .784 seconds?
Use bc -l instead of bc. That should do it.
No, that still gives 0 seconds.
I think this whole thing is dependent on the fact that `date +%s`
reports integers.
I'm still interested in
Can I refine it to give me something like: .784 seconds?
Use bc -l instead of bc. That should do it.
No, that still gives 0 seconds.
I think this whole thing is dependent on the fact that `date +%s`
reports integers.
I'm still interested in something like .874 seconds, but for the time
On Thu, 14 Aug 2003 11:08:21 -0500
Charles Howse [EMAIL PROTECTED] wrote:
On Thu, Aug 14, 2003 at 10:46:45AM -0500, Charles Howse wrote:
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
On Thu, 14 Aug 2003 18:34:25 +0100
Jez Hancock [EMAIL PROTECTED] wrote:
On Thu, Aug 14, 2003 at 12:23:34PM -0500, Stephen Hilton wrote:
On Thu, 14 Aug 2003 12:11:55 -0500
Charles Howse [EMAIL PROTECTED] wrote:
Charles,
This will set bc precision to 5 decimal places:
At 11:35 14.08.2003 -0500, Kirk Strauser wrote:
At 2003-08-14T16:08:21Z, Charles Howse [EMAIL PROTECTED] writes:
Can I refine it to give me something like: .784 seconds?
Use bc -l instead of bc. That should do it.
Yes, but not in the context mentioned before:
Start_time=`date +%s` #
On Thu, Aug 14, 2003 at 12:23:34PM -0500, Stephen Hilton wrote:
On Thu, 14 Aug 2003 12:11:55 -0500
Charles Howse [EMAIL PROTECTED] 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
OK, I've been playing with the time command to get the elapsed time of
my daily_report script reported in 2 decimal places.
If I do:
# \time -ha ~/daily.log ~/bin/daily_report (append output of time to
~/daily.log)
I get:
Time: /root/daily.log permission denied
(time output)
If I do:
# chmod 666
Got it going.
Instead of running daily_report from cron, I will now run the following:
-
#!/usr/local/bin/bash
# Time and run the Daily_report
\time -ho /root/tmp.time ~/bin/daily_report
cat /root/tmp.time | cut -f 2 | cut
22 matches
Mail list logo