rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: "Smarasderagd" <smarry@vex.net>
To: fosterd@hartwick.edu, rc@hawkwind.utcs.toronto.edu
Subject: Re: flattening a command substitution
Date: Tue, 11 Jul 2000 12:39:49 -0500
Message-ID: <20000711163949.21962.qmail@pantransit.reptiles.org> (raw)

"Decklin Foster" <fosterd@hartwick.edu> 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:
>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...

             reply	other threads:[~2000-07-12 22:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-07-11 17:39 Smarasderagd [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-07-08  2:50 Decklin Foster

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:

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

  git send-email \
    --in-reply-to=20000711163949.21962.qmail@pantransit.reptiles.org \
    --to=smarry@vex.net \
    --cc=fosterd@hartwick.edu \
    --cc=rc@hawkwind.utcs.toronto.edu \


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

rc-list - mailing list for the rc(1) shell

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.vuxu.org/rc-list

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 rc-list rc-list/ https://inbox.vuxu.org/rc-list \
	public-inbox-index rc-list

Example config snippet for mirrors.
Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git