Okay, there are a couple more things to discuss here. If we need to find out how long a variable is, we can use the following construct:
${#variable} |
So if we try:
echo ${#MAGIC} |
You should get :
11 |
Let's try another example:
NEW_MAGIC=${MAGIC##a*b} echo ${#NEW_MAGIC} |
We should end up with a value of:
2 |
Why? Because the pattern matches the 'ra' and the length of 'ra' is two characters.