zsh-users
 help / color / mirror / code / Atom feed
From: Philippe Troin <phil@fifi.org>
To: zsh-users@zsh.org
Subject: Weird rc_expand_param side effect or whitespace splitting
Date: Tue, 14 Feb 2023 12:17:26 -0800	[thread overview]
Message-ID: <5af9ede7d352f5f35d051cfa7df904994575bfc3.camel@fifi.org> (raw)

This has been stumping me:

   #!/bin/zsh -f
   
   echo $ZSH_VERSION 
   
   x=$'\t\t\t'
   
   y=("${(ps:\t:)x}")
   echo $#y
   
   setopt rcexpandparam
   y=("${(ps:\t:)x}")
   echo $#y

This script prints:
   5.8.1
   2
   4

Why does rc_expand_param interacts with string splitting?

I know that if you use:

   y=("{(@ps:\t:)x}")

Then $#y is always 4, whatever rcexpandparams is set to.

Phil.


             reply	other threads:[~2023-02-14 20:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-14 20:17 Philippe Troin [this message]
2023-02-14 21:11 ` Bart Schaefer

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=5af9ede7d352f5f35d051cfa7df904994575bfc3.camel@fifi.org \
    --to=phil@fifi.org \
    --cc=zsh-users@zsh.org \
    /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).