I am reading a shell scripts from github :script
It has two lines of code confused me. I have never seen ## used in bash like this before.
could anyone explain this to me, how does it work? thanks.
branch_name=$(git symbolic-ref -q HEAD)
branch_name=${branch_name##refs/heads/}
Note:The first line produces something like ‘refs/heads/master’
and the next line remove the leading refs/heads make the branch_name becomes master.
From the
bash(1)man page, EXPANSION section, Parameter Expansion subsection:Also available in the manual, of course (but it doesn’t seem to support linking to this exact text; search the page for
##).