${(p)…}
: Enable escape sequences in flags
(p)
enables escape sequences and variable substitution for options of the following flags.
By default, options are taken literally, for example ${(s:\t:)name}
splits words at a literal \t
.
With (p)
, ${(ps:\t:)name}
is splitting words at a TAB character and ${(ps:$sep:)name}
splits using the value of variable sep
.
Links
Examples
- Split string at TABs
- Output:
1 2
tsv=$'a\tb\tc' echo ${(ps:\t:)tsv}
1
a b c
BashSupport Pro 是一款支持 p** 的 **Zsh 集成开发环境 - 立即试用!