Need your help in understanding this

Hi,

I found this in a script and I would like to know how this works

Code is here:

# var1=PART1_PART2
# var2=${var1##*_}
# echo $var2
PART2

I'm wondering how ##* makes the Shell to understand to pick up the last value from the given.

This is called Shell's parameter expansion.. refer shell man page for more information or below link

Shell Command Language

1 Like

that explains better.. Thank you