From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28069 invoked by alias); 7 Apr 2014 15:11:15 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 18703 Received: (qmail 63 invoked from network); 7 Apr 2014 15:11:09 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 X-AuditID: cbfec7f5-b7fc96d000004885-cd-5342c0092733 Date: Mon, 07 Apr 2014 16:11:04 +0100 From: Peter Stephenson To: zsh-users@zsh.org Subject: Re: Reading output into variables Message-id: <20140407161104.3d46ad15@pwslap01u.europe.root.pri> In-reply-to: References: Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplluLIzCtJLcpLzFFi42I5/e/4FV3OA07BBm+PyFvsOLmS0YHRY9XB D0wBjFFcNimpOZllqUX6dglcGbMmtzAV3GKtOHH3PlMD436WLkZODgkBE4mO7pVMELaYxIV7 69m6GLk4hASWMkqcO3KKBcphkphzoYkRpIpFQFXizcp/7CA2m4ChxNRNs8HiIgKiEstXbAaL CwtoScw/+grM5hWwl5g9q4MZxOYU0JRY8v0L2GYhAQ2JzlmbwGr4BfQlrv79BHWFvcTMK2cY IXoFJX5MvgdWzww0c/O2JlYIW15i85q3zBMYBWYhKZuFpGwWkrIFjMyrGEVTS5MLipPSc430 ihNzi0vz0vWS83M3MUKC8OsOxqXHrA4xCnAwKvHwBhxwDBZiTSwrrsw9xCjBwawkwsu12ilY iDclsbIqtSg/vqg0J7X4ECMTB6dUA+OdE5GJmbd7nba18LEe7XnDNkN8mmvEcds1E4w0cq9r 3Y38mxiZ7f1LpPP7i0Uat1ZHRL29/qlG/v1xEx+RnqjHv9aa7U01zN7zcuvjLu1Vnkz7Z03X YdB7E8XsVLmM6+0n2X/b1185JdEUuaeXa/X2oFkW4rZT5brNWO31Nkzoj7xj7jT5QbsSS3FG oqEWc1FxIgBM0RydIAIAAA== On Mon, 07 Apr 2014 16:20:20 +0200 Yuri D'Elia 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