[ale] output redirection (easy?)
Joseph A Knapka
jknapka at earthlink.net
Mon Dec 3 07:36:52 EST 2001
Chris Bergeron wrote:
>
> I have a feeling this is a simple question:
>
> I'm trying to get the time from a command:
> time dd if=/dev/hda of=/backup/system.img > /backup/system.msg
>
> but... when it runs I get the output of the dd command;
>
> soooo..... I tried to redirect again as:
> time dd if=/dev/hda of=/backup/system.img > /backup/system.msg >
> /backup/system.msg
>
> and... no go. Any suggestions?
( time <cmd> ) 2>foo
This works because it's (a) redirecting the output of the
entire command "time <cmd>", not the output of "<cmd>"
alone, and (b) redirecting standard error, which is where "time"
writes the timing data. In general, the ( ) list notation
will glom all the output from the commands within ( ) into
a single pair of output and error streams.
So in your case,
( time dd if=/dev/hda of=/backup/system.img ) 2&>/backup/system.msg
should work.
Cheers,
-- Joe
---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be
sent to listmaster at ale dot org.
More information about the Ale
mailing list