Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11906

Re: redirecting a file descriptor to an array variable? Possible? How? RFE?

From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups gnu.bash.bug
Subject Re: redirecting a file descriptor to an array variable? Possible? How? RFE?
Date 2015-11-18 13:46 -0500
Message-ID <mailman.167.1447872433.31583.bug-bash@gnu.org> (permalink)
References <564532BD.60801@tlinx.org> <20151113131735.GE27325@eeg.ccf.org> <56488802.10800@tlinx.org> <20151116134157.GJ27325@eeg.ccf.org> <564CC08E.9060809@tlinx.org>

Show all headers | View raw


On Wed, Nov 18, 2015 at 10:16:46AM -0800, Linda Walsh wrote:
> 	So just like you can have [<>|]&[-0-9][0-0] as redirection ops that 
> 	work
> with files or FD's, why not have something like:
> 
> out=()
> printf '%s\0' "${array[@]}" >&{out[@]} (**)
> 
> **: or ">@out" or ">&@out"

You seem to be a bit unfocused here.  If you seriously want to request
a new shell feature of this level of complexity, you're going to have
to come up with an actual syntax and specification.  Then you and Chet
may have to discuss implementation details that I can't even guess at.

I would steer away from >&punc where "punc" is some third punctuation
characters.  We already have >&word for FD duplication and closing,
where "word" can be an integer FD to duplicate, or - to mean close.
Find some syntax that won't conflict with existing features.

Also note that you still wouldn't be able to store \0 (NUL) bytes in
bash variables.

Also note that if you just want to copy the content of an array (but
not the indices) to another array, you can write:

  out=("${in[@]}")

You should stop using irrelevant examples, and return to your core
question.  I believe your initial goal was to run a command, and capture
the command's stdout in one variable, and the command's stderr in another
variable, without using any temp files.

Come up with some syntax and specification to achieve that, and present
it to Chet.

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: redirecting a file descriptor to an array variable? Possible? How? RFE? Greg Wooledge <wooledg@eeg.ccf.org> - 2015-11-18 13:46 -0500

csiph-web