A variable can be referred to as either $VARNAME
or ${VARNAME}
. The latter form is useful if the variable name is followed by something that's not supposed to be part of the variable name. For example say you have a variable FOO
and you want to print the contents of the variable followed by the string "_BAR". If you write echo $FOO_BAR
it will look for a variable named FOO_BAR
. So you write echo ${FOO}_BAR
instead.
In this case there's a space directly after the ${0}
so the braces aren't actually necessary. So in this case there is no difference between the two.