copyright
@ahmubashshir's blog
Evidence of my terrible writing skills.
https://ahmubashshir.github.io/
${<name>%<pattern>}
matches and replaces it from the right once
${<name>#<pattern>}
same, but from left
${<name>##<pattern>}
replace all, from left
${<name>%%<pattern>}
replace all from right
- depends on implementation(eg. sh provided by dash doesn’t support them)
eg.
test=a.b.c.d/e.f/g-h/i.j.k echo ${test%. _} echo ${test%%._ } echo ${test# _.} echo ${test##_ .} echo ${test%e.f/ _} echo ${test#_ /e.f} echo ${test%i.j.?}
snap:
[Image: Untitled 10.png]