${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 is a Zsh IDE with support for $varName:amptry it now!
© 2020–2024 Joachim Ansorg
Imprint
Privacy Policy
Legal