bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Greg Wooledge
Subject: Re: redirecting a file descriptor to an array variable? Possible? How? RFE?
Date: Wed, 18 Nov 2015 13:46:38 -0500
User-agent: Mutt/1.4.2.3i

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' "address@hidden" >&address@hidden (**)
> 
> **: 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=("address@hidden")

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]