euglug.org

[Eug-lug] Unix ‘time’ command

작성자

카테고리:



Jim BeardWed Mar 30 15:12:03 PST 2005

Larry for the win!!!

Thanks,
Jim

On Mar 30, 2005, at 2:38 PM, larry price wrote:

> You are using the shell builtin time rather than the time command
>
> use
>
> which time #prints a path to the time command
> /usr/bin/time -o foo.txt ls #using the full path ensures you are using
> the command
> cat foo.txt
>
>
>
>
>
> On Wed, 30 Mar 2005 14:37:50 -0800, Jim Beard <beard at counterclaim.com> 
> wrote:
>> Howdy folks,
>>
>>         It's time for my bi-weekly simple(for some!) unix/linux 
>> question!  I'm
>> working on a shell script to automate some back ups using rsync.  I
>> would like to know how long the rsync process takes to complete.  In
>> order to do this I was hoping to execute the command with 'time' and
>> then capture time's output.  The problem is that any output 
>> redirection
>> I append to the command (like ' > logfile.txt' gets applied to the
>> command, and not to time.  Time supposedly has an option for this, but
>> I have likewise not been able to get this to execute correctly.
>>
>> I've tried:
>>
>> time -o test.txt ls
>> bash: -o: command not found
>>
>> real    0m0.002s
>> user    0m0.000s
>> sys     0m0.000s
>>
>> and
>>
>> time ls -o test.txt
>> ls: test.txt: No such file or directory
>>
>> real    0m0.009s
>> user    0m0.000s
>> sys     0m0.010s
>>
>> along with similar variations including >'s and 2>'s and 2>&1's all
>> sprinkled about.  Does anyone have any experience with this?
>>
>> Jim Beard
>> counterclaim.com, Inc
>> http://www.counterclaim.com
>> http://openefm.sourceforge.net
>> (800) 264-8145
>>
>> _______________________________________________
>> EUGLUG mailing list
>> euglug at euglug.org
>> http://www.euglug.org/mailman/listinfo/euglug
>>
>
>
> -- 
> http://Zoneverte.org -- information explained
> Do you know what your IT infrastructure does?
> _______________________________________________
> EUGLUG mailing list
> euglug at euglug.org
> http://www.euglug.org/mailman/listinfo/euglug
>
>
Jim Beard
counterclaim.com, Inc
http://www.counterclaim.com
http://openefm.sourceforge.net
(800) 264-8145