${(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 ist eine Zsh IDE mit Unterstützung für ${(p)…} - probieren Sie es jetzt aus!