linux - What is the functionality of ## and %% in bash -
disk="/dev/sda" local dev_node=${disk##*/}
dev_node assigned "sda".
also,
partition="/dev/sda3" echo ${partition%%[0-9]*}
it returns /dev/sda , remove 3.
i did not understand functionality of ##*/ , %%[0-9]*in above commands. tried searching not enough information.
please explain , provide links tutorial related this.
this manual / tutorial. concerns question:
${string##substring} deletes longest match of $substring front of $string.
and
${string%%substring} deletes longest match of $substring back of $string.
applied example: removing longest substring matching */
/dev/sda
results in sda
Comments
Post a Comment