On Thu, 2003-08-21 at 17:46, Cameron Simpson wrote:
> On 16:38 21 Aug 2003, Peram's List <[EMAIL PROTECTED]> wrote:
> | I appreciate your quick response.
> | Is there any way I get the time taken for the execution of a script from
> | the script itself instead of typing it at the command line.
> 
> Well, if you're still inside the script then the won't be "the time the
> script took to execute", because the script's still running.
> 
> But you can do things like:
> 
>       start=`perl -e 'print time'`
>       .... body of script here ...
>       end=`perl -e 'print time'`
>       echo "took `expr $end - $start` seconds"
> 

Hmmm.  wouldn't start=$(date +%s) be a bit more efficient?


[EMAIL PROTECTED] init.d]$ time perl -e'print time'
1061507775
real    0m0.008s
user    0m0.004s
sys     0m0.004s
[EMAIL PROTECTED] init.d]$ time date +%s
1061507784

real    0m0.006s
user    0m0.002s
sys     0m0.004s
[EMAIL PROTECTED] init.d]$ 


Bret



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list

Reply via email to