zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: capture stderr in command substitution
Date: Mon, 25 Jan 2021 07:15:24 -0800	[thread overview]
Message-ID: <38504cf6-a3c0-eb22-8a0b-6410d27ebbbc@eastlink.ca> (raw)
In-Reply-To: <20210124194750.dtyacd5emjauwxec@sym.noone.org>

On 2021-01-24 11:47 a.m., Axel Beckert wrote:
>
>    $ var=$(command 2>&1)
>
Thanks, superficial testing shows it working fine.  I finally sorta 
understand it too, you can read it as 'output #2 goes back to output #1.

var=$(cmd>&2)

That seems not to work but I'm in no mood to look into it so long as Axel's performs.

{ var=$(cmd 2>&1 >&3 3>&-); } 3>&1

... is not something that the eye's of a mortal should ever look upon ;-)

BTW (not worth starting a thread on this) how do you keep a command out of history?  I usta know this but can't remember and I've written it down somewhere but can't find it :(
I take a year off from coding anything and forget 101% of what I had learned.



  reply	other threads:[~2021-01-25 15:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-24 19:45 Ray Andrews
2021-01-24 19:47 ` Axel Beckert
2021-01-25 15:15   ` Ray Andrews [this message]
2021-01-25 15:51     ` Vin Shelton
2021-01-25 16:28       ` Pier Paolo Grassi
2021-01-25 21:42         ` Bart Schaefer
2021-01-25 20:33       ` Ray Andrews
2021-01-25 12:38 ` Stephane Chazelas
2021-01-25 13:18   ` Stephane Chazelas

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=38504cf6-a3c0-eb22-8a0b-6410d27ebbbc@eastlink.ca \
    --to=rayandrews@eastlink.ca \
    --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).