${(s:string:)…}
: Splitting separator
s:string:
defines the splitting separator string when word splitting is applied.
The complete string is used as separator. With an empty string each character is split into a separate word.
Links
Examples
- Split by string
- Output:
1 2 3
value="Sunday-Monday-Tuesday-Wednesday-Thursday-Friday-Saturday" days=( ${(s:-:)value} ) typeset days
1
days=( Sunday Monday Tuesday Wednesday Thursday Friday Saturday )
BashSupport Pro 是一款支持 s** 的 **Zsh 集成开发环境 - 立即试用!