Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

csh script help - capturing stdout and stderr

Status
Not open for further replies.

nappaji

Programmer
Mar 21, 2001
76
US
I am trying to write a csh script to execute the rsync command periodically.

But, I donot know how to capture the standard output and standard error. My ultimate goal is to capture this stdout and stderr and mail it to the user.

How can I accomplish this??

I tried to so something like this
 
From man csh:
Code:
> name
>! name
>& name
>&! name
  Opens the file name as the standard output. If the file does not exist, then it is created; if the file exists, it is overwritten.
  If the variable noclobber is set, then an error results if the file already exists or if it is not a character special file (for example, a terminal or /dev/null). This helps prevent accidental destruction of files. In this case, the ``!'' forms can be used to suppress this check.
  The forms involving ``&'' route the standard error into the specified file as well as the standard output. name is expanded in the same way as ``<'' input filenames are.

Hope This Help
PH.
 

If you want to separate stdout and stderr into different files you can

( command > stdout_file ) >& stderr_file

All the stuff in the last post applies with relation to > and >& and >&! and >! if you want to use those forms instead.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top