zsh-users
 help / color / mirror / code / Atom feed
* Weird rc_expand_param side effect or whitespace splitting
@ 2023-02-14 20:17 Philippe Troin
  2023-02-14 21:11 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Philippe Troin @ 2023-02-14 20:17 UTC (permalink / raw)
  To: zsh-users

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-14 21:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-14 20:17 Weird rc_expand_param side effect or whitespace splitting Philippe Troin
2023-02-14 21:11 ` Bart Schaefer

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