Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Weird rc_expand_param side effect or whitespace splitting
- X-seq: zsh-users 28943
- From: Philippe Troin <phil@xxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Weird rc_expand_param side effect or whitespace splitting
- Date: Tue, 14 Feb 2023 12:17:26 -0800
- Archived-at: <https://zsh.org/users/28943>
- List-id: <zsh-users.zsh.org>
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