From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.rdc1.ct.home.com ([24.2.0.66]) by hawkwind.utcs.utoronto.ca with SMTP id <44201>; Mon, 10 Jul 2000 15:28:23 -0500 Received: from c26469-a.clnvl1.ct.home.com ([24.2.177.105]) by mail.rdc1.ct.home.com (InterMail vM.4.01.03.00 201-229-121) with SMTP id <20000708014909.XWYL3097.mail.rdc1.ct.home.com@c26469-a.clnvl1.ct.home.com> for ; Fri, 7 Jul 2000 18:49:09 -0700 Received: by c26469-a.clnvl1.ct.home.com (sSMTP sendmail emulation); Fri, 7 Jul 2000 21:50:38 +4400 Date: Fri, 7 Jul 2000 21:50:38 -0500 From: "Decklin Foster" To: rc@hawkwind.utcs.toronto.edu Subject: flattening a command substitution Message-ID: <20000707215038.A5353@c26469-a.clnvl1.ct.home.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i Organization: Society for the Prevention of Cruelty to Vermin 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: ; pwd /home/decklin ; mkdir 'foo bar' ; cd 'foo bar' ; ls `{pwd} ls: /home/decklin/foo: No such file or directory ls: bar: No such file or directory [nonzero status 1] ; ls ``(){pwd} ls: /home/decklin/foo bar : No such file or directory [nonzero status 1] ; 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 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? -- There is no TRUTH. There is no REALITY. There is no CONSISTENCY. There are no ABSOLUTE STATEMENTS. I'm very probably wrong. -- BSD fortune(6)