##*_ - whats this?

Hi all,

could you please tell me whats this stands

##_
0##
/

i knew this alone if some more is there please tell me that also.

what where you doing to get this output?

the below is the statement in my script.

  1. read -r variable < /path/file.txt
    finalvar=${variable##*_}

  2. MYNAME=${0##*/};

please let me know what it is actually doing.

They are pattern matching arguments used to strip off certain portions of a string from either the front or end of the string.

Example:

$ >  STRING=this_test_string
$ >  echo ${STRING##*_}
string

$ >  DIR=/home/user1/test
$ > echo ${DIR##*/}
test