Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

pipes and redirection



I've been trying desparately to do something with the shell and failing.

The goal is to get stdout to go to a file, and stderr to be piped to
another program.

If I do this:

(print -u2 This is stderr;print This is stdout) 2>&1 1>test

Then the file "test" contains the string "This is stdout"
and "This is stderr" is printed to the terminal.

So, assuming that the pipe (|) should send the stdout (file descriptor 1) on
to the program, I tried this:

(print -u2 This is stderr;print This is stdout) 2>&1 1>test | less

which brought up less, with _both_ strings displayed.
So, clearly, the | is picking up both streams.

Is there a way to cleanly do what I want it to do?

--
Gerry
Gerald Skerbitz <gsker@xxxxxxxxxxx> U of MN Med School Admin 6-5379
Home St. Paul,Ramsey County,Minnesota, USA




Messages sorted by: Reverse Date, Date, Thread, Author