home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.shell
- Path: sparky!uunet!stanford.edu!leland.Stanford.EDU!dkeisen
- From: dkeisen@leland.Stanford.EDU (Dave Eisen)
- Subject: Re: How to redirect outputs from the command "time" into a file?
- Message-ID: <1992Nov7.184411.15962@leland.Stanford.EDU>
- Sender: news@leland.Stanford.EDU (Mr News)
- Organization: Sequoia Peripherals, Inc.
- References: <1992Nov5.024837.6571@cs.tulane.edu> <fish.720983465@news2.gsfc.nasa.gov> <1992Nov6.231410.28155@ccd.harris.com>
- Date: Sat, 7 Nov 92 18:44:11 GMT
- Lines: 33
-
- In article <1992Nov6.231410.28155@ccd.harris.com> zhu@controls.ccd.harris.com (Gary Zhu) writes:
- >
- >In article <fish.720983465@news2.gsfc.nasa.gov>, fish@daacdev1.stx.com writes:
- >|>
- >|> time puts its output on stderr (not noted in any man page i've
- >|> ever seen either) so:
- >|> time a.out 2>a.time
-
- >Almost got it.
- >"time" will consider the rest of the line as a whole, so
- >time a.out 2>a.time
- >will be interpreted as : run "a.out 2>a.time" and report the
- >running time of "a.out 2>a.time".
- >
- >SOLUTION : (time a.out) 2>a.time
-
- Fish was right. Assuming a Bourne-like shell (he did use the 2>a.time
- Bourne syntax), time couldn't possibly report the running time of the
- redirected command because the redirection would occur before /bin/time
- was called.
-
- Of course, all of this changes if time is a shell builtin, like it
- is in csh and tcsh and probably some others. Then time can (and in
- the case of csh does) time the redirected command and your answer
- would be correct if csh used the 2>a.time syntax for redirection.
-
-
-
- --
- Dave Eisen Sequoia Peripherals: (415) 967-5644
- dkeisen@leland.Stanford.EDU Home: (415) 321-5154
- There's something in my library to offend everybody.
- --- Washington Coalition Against Censorship
-