Please use ***[code][/code] tags
*** around your code and data, to preserve formatting and to improve readability. Please do not
use quote tags, colors, or other fancy formatting.
One small addition to the above.
You really should never leave a variable unprotected. So single quote the parts that need to be literal, and double-quote the parts that need expansion.
(And lose the brackets around the variables. They are unnecessary in most cases, and do nothing but add clutter to the code.)
In detail: you should never leave the quotes off a parameter expansion unless you explicitly want the resulting string to be word-split by the shell (globbing patterns are also expanded). This is a vitally important concept in scripting, so train yourself to do it correctly now. You can learn about the exceptions later.
(The site is bash-centric, but the above applies to all bourne-style shells.)