Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Reading output into variables



On Mon, 07 Apr 2014 16:20:20 +0200
Yuri D'Elia <wavexx@xxxxxxxxxx> wrote:
> Maybe a stupid question, but is there a way to read the output of a
> program and split into variables _conveniently_ using the IFS?
> 
> To clarify, I would the something as convenient as:
> 
> program | read a b
> 
> minus the subshell.

I'm not quite sure what you're objecting to.  If "program" is an
external programme (but you can call it a program if you want :-)) this
is already handled efficiently because the shell exec's it directly from
the subshell, so there's only a single fork.

Beyond that, there are other possibilities, but none of them stand
out as obviously neater or more efficient, given the facts above.

pws



Messages sorted by: Reverse Date, Date, Thread, Author