From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pantransit.reptiles.org ([209.157.133.146]) by hawkwind.utcs.utoronto.ca with SMTP id <44232>; Wed, 12 Jul 2000 17:54:10 -0500 Received: (qmail 21963 invoked by uid 204); 11 Jul 2000 16:39:49 -0000 Date: Tue, 11 Jul 2000 12:39:49 -0500 Message-ID: <20000711163949.21962.qmail@pantransit.reptiles.org> From: "Smarasderagd" To: fosterd@hartwick.edu, rc@hawkwind.utcs.toronto.edu Subject: Re: flattening a command substitution "Decklin Foster" writes: >Is there a way to perform a command substitution and flatten it all at >once? For example, say I want to work with a pwd that has spaces: Or worse, tabs. >Now, there are two ways I can get it to work: use a newline as the >ifs-value, or have a temporary variable: > >pwd=`{pwd} >ls $^pwd I usually do: nl = ' ' somewhere at the top of the script. I sometimes also have tab = ' '. Later, if I want to ignore other whitespace: ls ``($nl){pwd} >Neither strike me as being very elegant. The first option doesn't >generalize to commands with multi-line output, and having to waste a >variable seems wrong. Does anyone have a better idea? For commands with multi-line output, ``(){command} seems like the right thing to me. As others may have discovered, it still splits the output if it happens to contain nulls, which I actually find rather useful if I want to do things with the output of find with the -print0 option...