[blfs-dev] bash script

Christopher Gregory me at pc-networking-services.com
Mon Jun 2 16:16:32 PDT 2014

On Tue, June 3, 2014 4:59 am, Bruce Dubbs wrote:
> Aleksandar Kuktin wrote:
>> # ... yada yada yada ...
>> } 2>&1 | tee $SDIR/logs/$PROGRAM.log
>> time_elapsed=$(grep 'Elapsed Time' $SDIR/logs/$PROGRAM.log | \ sed
>> 's/^\([[:digit:]]\+\)\..*$/\1/');
>> # ...
>> echo "SBU: $(($time_elapsed / $standard_sbu))"
>> But no matter, the
>> infomation we need is inside the log file, so you just make a second pass
>> over the log file when all is done and extract the result.
> Right.  In my case, I happen to know that the line I need is the last
> one in the current log, so I use
> buildtime=`tail -n1 $log|cut -f1 -d" "`
> Note that the time output honors the TIMEFORMAT environment variable, so
> I am using TIMEFORMAT="%1R Elapsed Time - $TITLE", so I get for output
> something like  '123.4 Elapsed Time - some title'
> I then use bc to do the math and that gets a bit more accuracy, which
> helps especially for the packages that are less than 1 SBU.
> sbu=`echo "scale=3; $buildtime / $base_sbu" | bc`
> -- Bruce
> --
> http://lists.linuxfromscratch.org/listinfo/blfs-dev
> FAQ: http://www.linuxfromscratch.org/blfs/faq.html
> Unsubscribe: See the above information page
Hello Bruce,

Thanks for this.  I think that I am going to be using your way of doing it
for the gnome book.

I did not know that there would be multiple replies to this, so I do feel
bad that some may not get used.  Though I can always try out some of the
others, just to see if there are any differences in the calculations.

It is really weird that the times do vary between runs of the script.



More information about the blfs-dev mailing list