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
- X-seq: zsh-users 24151
- From: TJ Luoma <luomat@xxxxxxxxx>
- To: Aryn Starr <whereislelouch@xxxxxxxxxx>
- Subject: Re: Capture stdout, stdin, and exit status in different variables without using temporary files
- Date: Fri, 16 Aug 2019 09:01:40 -0400
- Cc: Zsh MailingList <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=U6+FNnItHIidcepn+Mbr4Kdfn2+RaDsHAbmNroI4r8Q=; b=PIiWy7NniDa41hp43QV3e0Fg2C04/w6oVm7YSWJWHCiDUEfW5rUv2GG1dAuc8Owwrw Q85bEHBemJ71GR9v5RFWg6w9dx2ShXEDJ/YHSU2GZKwvEJ0jjxTMHkLnhRhmu9PzmxiR ag3xUfWcH+7LC2x4OlWCKYshnrCAQ+yi6XKOhs1foHE8fg2DlDRXKKHMD2BUHWd+hnGx WTeAj7ePLX9b8H60nHdfRfnNJ398UWbGsRrkDCivCXjc1zEh2k+gSFO3i9va6R4Hc058 GaNf9/3APyQFqAcUw7JKwzS8IwAjTgonNrkI363xUebcHmVS4iexAr+2iu2gm5eDdz3d hTtQ==
- In-reply-to: <70382019-1857-4452-85FC-F038D8BBE206@icloud.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <D639E5A6-A28C-40EE-B0E6-27BED4C8CDDB__31117.9253900022$1565917892$gmane$org@icloud.com> <20190816100501.nsvfbdwwnoaihlhe@chaz.gmail.com> <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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author