zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@sunsite.dk>
Subject: Re: Is this a side effect of RC_EXPAND_PARAM?
Date: Sun, 04 Dec 2005 00:16:16 +0000	[thread overview]
Message-ID: <1051204001616.ZM15244@candle.brasslantern.com> (raw)
In-Reply-To: <20051202210456.GA821@DervishD>

On Dec 2, 10:04pm, DervishD wrote:
}
}     What am I doing wrong? Is this a bug or a feature?

zagzig% var="one|two||four|five"
zagzig% print -l "${(s:|:)var}"
one
two
four
five
zagzig% setopt rcexpandparam
zagzig% print -l "${(s:|:)var}"
one
two

four
five
zagzig% 

With rcexpandparam the empty element is retained so that it can be joined
with whatever appears on both sides of the expansion (even though in this
case that's nothing) so you get the equivalent of

    vara=("one" "two" "" "four" "five")

whereas with it NOT set, the empty element is removed, so you get

    vara=(one two  four five)

Forcing empty elements to be retained as empty rather than removed is
one reason the compsys functions have rcexpandparam set.  Admittedly
this ought to be documented, rather than assuming that anyone who sets
rcexpandparam must be familiar with the semantics of the rc shell ...


  reply	other threads:[~2005-12-04  0:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-02 21:04 DervishD
2005-12-04  0:16 ` Bart Schaefer [this message]
2005-12-04  8:30   ` DervishD

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=1051204001616.ZM15244@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@sunsite.dk \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).