Variable substitution not working in shell scripting