perl_mystery has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I have a command "cmd" I run from command line but now I want to save stout aswell as sterr to a log.I know 2>&1 has a way to do that? cmd 2>&1 cmd.log is not working?,what is the exact command?

Replies are listed 'Best First'.
Re: how to use 2>&1
by wind (Priest) on Mar 03, 2011 at 19:43 UTC
    cmd > cmd.log 2>&1
Re: how to use 2>&1
by Illuminatus (Curate) on Mar 03, 2011 at 19:55 UTC
    This is also dependent on which shell you are using. The syntax you alluded to, and was corrected by wind was originally for Bourne shell. If you are using bash, you can also use cmd >& cmd.out. For csh, you should probably use cmd >&! cmd.out.

    fnord