rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: "Decklin Foster" <fosterd@hartwick.edu>
To: rc@hawkwind.utcs.toronto.edu
Subject: flattening a command substitution
Date: Fri, 7 Jul 2000 21:50:38 -0500	[thread overview]
Message-ID: <20000707215038.A5353@c26469-a.clnvl1.ct.home.com> (raw)

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)


             reply	other threads:[~2000-07-10 20:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-07-08  2:50 Decklin Foster [this message]
2000-07-11 17:39 Smarasderagd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20000707215038.A5353@c26469-a.clnvl1.ct.home.com \
    --to=fosterd@hartwick.edu \
    --cc=rc@hawkwind.utcs.toronto.edu \
    --subject='Re: flattening a command substitution' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).