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

Re: Capture stdout, stdin, and exit status in different variables without using temporary files



I have used this, which I am sure someone on the zsh probably gave me:

(){ STDOUT=$( your-command-here 2> $1) STDERR=$(<$1);} =(:)

Using an actual example… I know that `find -x / -maxdepth 4 -print`
will provide both kinds of output, so if I use that here:

(){ STDOUT=$( find -x / -maxdepth 4 -print 2> $1) STDERR=$(<$1);} =(:)

then I can use $STDOUT and $STDERR to get the respective outputs.

I hope that helps!

Tj

--
TJ Luoma
TJ @ MacStories
Personal Website: luo.ma (aka RhymesWithDiploma.com)
Twitter: @tjluoma



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