From: TJ Luoma <luomat@gmail.com>
To: Aryn Starr <whereislelouch@icloud.com>
Cc: Zsh MailingList <zsh-users@zsh.org>
Subject: Re: Capture stdout, stdin, and exit status in different variables without using temporary files
Date: Fri, 16 Aug 2019 09:01:40 -0400 [thread overview]
Message-ID: <CADjGqHva=YphU8hy+N2psfDNAAW1ZqSd5+=hgms5UcDo9o5YPA@mail.gmail.com> (raw)
In-Reply-To: <70382019-1857-4452-85FC-F038D8BBE206@icloud.com>
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
next prev parent reply other threads:[~2019-08-16 13:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <D639E5A6-A28C-40EE-B0E6-27BED4C8CDDB__31117.9253900022$1565917892$gmane$org@icloud.com>
2019-08-16 7:22 ` Stephane Chazelas
2019-08-16 10:05 ` Stephane Chazelas
2019-08-16 10:45 ` Aryn Starr
2019-08-16 13:01 ` TJ Luoma [this message]
2019-08-16 13:16 ` Roman Perepelitsa
2019-08-16 17:08 ` TJ Luoma
2019-08-15 15:52 Aryn Starr
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADjGqHva=YphU8hy+N2psfDNAAW1ZqSd5+=hgms5UcDo9o5YPA@mail.gmail.com' \
--to=luomat@gmail.com \
--cc=whereislelouch@icloud.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).