I'm using following script for Shortest Sub-string Match in String handling.
filename="bash.string.txt"
echo ${filename#*.}
It gives following output.
string.txt
Here is an explanation of above example (Link: https://www.thegeekstuff.com/2010/07/bash-string-manipulation):
The above example deletes the shortest match of $substring from front of $string. In the first echo statement substring ‘*.’ matches the characters and a dot, and # strips from the front of the string, so it strips the substring “bash.” from the variable called filename.
Then I changed the code as below:
filename="bashshell.string.txt"
echo ${filename#*.}
I just extended the first string from bash. to bashshell. and expecting the output "bashshell.txt" according to explanation given above. But instead it gives me same output as first example.
i.e. string.txt
So do I misunderstood the concept? If yes than how it actually works?