${(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.

Examples

Split by string
1
2
3
value="Sunday-Monday-Tuesday-Wednesday-Thursday-Friday-Saturday"
days=( ${(s:-:)value} )
typeset days
Output:
1
days=( Sunday Monday Tuesday Wednesday Thursday Friday Saturday )
BashSupport Pro 是一款支持 s** 的 **Zsh 集成开发环境 - 立即试用
© 2020–2024 Joachim Ansorg
声明
隐私政策
许可条款