Redirection of standard error

Redirection of standard error

Post by Gianluca Carus » Thu, 06 Apr 2000 04:00:00



I need to redirect standard error during the execution of a command
but not standard output. Is it possible ?
 
 
 

Redirection of standard error

Post by luke.davie » Thu, 06 Apr 2000 04:00:00


Yes

Use 2> error_file at the end of your command

e.g.

ls *no_files* 2> /tmp/ls_error

Cheers

Luke

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!

 
 
 

Redirection of standard error

Post by MaggieJo » Sat, 08 Apr 2000 04:00:00


Quote:>Use 2> error_file at the end of your command

>e.g.

>ls *no_files* 2> /tmp/ls_error

This won't work in c shell though.   But you can make it into a Borne shell
script and then it works quite nicely!

- Maggie

 
 
 

Redirection of standard error

Post by Avi Abram » Thu, 13 Apr 2000 04:00:00



> I need to redirect standard error during the execution of a command
> but not standard output. Is it possible ?

It certainly is, and very well documented in the man page.
The question is, what shell are you using?
Example using Bourne (sh), Korn (ksh) and Bourne Again (bash) shells:

    your_command 2> some_file

This will send all error output to a file named "some_file"
and normal output (from "your_command") to the screen.

Example using C (csh) and Tenex C (tcsh) shells:

    ( your_command > output_file ) >& error_file

This will send normal output (of "your_command") to a file
named "output_file", and error output (of "your_command")
to a file named "error_file".

As I said before, output redirection is explained in the
man pages. So - depending on the shell you use - try one
of

    man sh
    man ksh
    man bash
    man csh
    man tcsh

HTH,
Avi.

--
  /\ \    /| Avi Abrami, Analyst/Programmer, Terayon Comms

/    \ \/  | http://www.terayon.com