${name:&}: Repeat substitution

Repeats the previous :s substitution.

Use :g& to replace all occurrences of the previous substitution.

Examples

Print path without file extension
1
2
3
4
5
value="Joe Dalton, William Dalton, Jack Dalton and Averell Dalton"
# Strip first "Dalton"
value=${value:s/ Dalton//}
# Strip all remaining
echo ${value:g&}
Output:
1
Joe, William, Jack and Averell
BashSupport Pro 是一款支持 amp** 的 **Zsh 集成开发环境 - 立即试用
© 2020–2025 Joachim Ansorg
声明
隐私政策
许可条款