Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Weird rc_expand_param side effect or whitespace splitting



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.




Messages sorted by: Reverse Date, Date, Thread, Author