bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: time command


From: Eric Blake
Subject: Re: time command
Date: Mon, 23 Jun 2008 06:13:45 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080421 Thunderbird/2.0.0.14 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[redirecting to bug-bash, as this is a bash-specific question]

According to Yu Cha Yung on 6/23/2008 12:24 AM:
|    Hi,
|    I am trying to export the output of time into a text file but failed
=sing
|    the following command:
|    time ls > time.txt
|    It doesnt show the information of time in time.txt.

That's because in bash, time is a reserved word, and because time's output
goes to stderr, not stdout.  You need a compound command, such as:

{ time ls; } >time.txt 2>&1

or avoid the bash reserved word to invoke /bin/time (assuming you have a
replacement program installed):

\time ls >time.txt 2>&1

|    basically i try all the option for time and only -p option works. Do
you    have any ideas on this matter? Thx!

That's because the bash reserved word time only supports -p (try 'help
time' to see this).

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhfk3gACgkQ84KuGfSFAYC69QCfULlCIQM2wSqOsHaqBk7UFfpT
zUMAn0PMCpluzJqO9SO7wVbzMjI5Drai
=+z1I
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]