Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Reading output into variables
- X-seq: zsh-users 18703
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Reading output into variables
- Date: Mon, 07 Apr 2014 16:11:04 +0100
- In-reply-to: <lhuc74$rjf$1@ger.gmane.org>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Organization: Samsung Cambridge Solution Centre
- References: <lhuc74$rjf$1@ger.gmane.org>
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