|
Top Document: Unix - Frequently Asked Questions (2/7) [Frequent posting] Previous Document: How do I ... and have that change affect my current shell? Next Document: How do I tell inside .cshrc if I'm a login shell? See reader questions & answers on this topic! - Help others by sharing your knowledge
Date: Mon, 26 Oct 1992 20:15:00 -0500
2.9) How do I redirect stdout and stderr separately in csh?
In csh, you can redirect stdout with ">", or stdout and stderr
together with ">&" but there is no direct way to redirect stderr
only. The best you can do is
( command >stdout_file ) >&stderr_file
which runs "command" in a subshell; stdout is redirected inside
the subshell to stdout_file, and both stdout and stderr from the
subshell are redirected to stderr_file, but by this point stdout
has already been redirected so only stderr actually winds up in
stderr_file.
If what you want is to avoid redirecting stdout at all, let sh
do it for you.
sh -c 'command 2>stderr_file'
User Contributions:Top Document: Unix - Frequently Asked Questions (2/7) [Frequent posting] Previous Document: How do I ... and have that change affect my current shell? Next Document: How do I tell inside .cshrc if I'm a login shell? Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page [ Usenet FAQs | Web FAQs | Documents | RFC Index ] Send corrections/additions to the FAQ Maintainer: tmatimar@isgtec.com (Ted Timar)
Last Update March 27 2014 @ 02:12 PM
|

Comment about this article, ask questions, or add new information about this topic: