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:


So if we try:

echo ${#MAGIC} 

You should get :


Let's try another example:

echo ${#NEW_MAGIC}

We should end up with a value of:


Why? Because the pattern matches the 'ra' and the length of 'ra' is two characters.