[Solved] Shell : Can someone show me how to used these ?

${var%pattern}
    removes the shortest suffix of $var patching pattern 
${var%%pattern}
    removes the longest suffix of $var patching pattern 
${var#pattern}
    removes the shortest prefix of $var patching pattern 
${var##pattern}
    removes the longest prefix of $var patching pattern

Check this, illustrated with examples

Bash String

HTH

--ahamed

2 Likes

Sweet !! That was exactly what I was looking for ... simple easy to understand.

Thanks again !!