Search This Blog

Sunday, February 8, 2009

Redirections, Standard I/O


BasicS  ...


Most of the cases we use this redirection operators in shell script or at prompt level.

./scriptname.sh > logfile         To send the standard output of ./scriptname by replacing the existing logfile

./scriptname.sh >> logfile     To send the standard output of ./scriptname by appending the existing logfile

./scriptname.sh 2> logfile       To send the standard error while running the scriptname.sh

./scriptname.sh 2>> logfile    To send the standard error while running the scriptname.sh with append

Lets go to some advanced...

To send standard error as well as standard output to logfile

./scriptname.sh  2> logfile >&1    

(OR)

./scriptname.sh  > logfile 2>&1










No comments:

Post a Comment