Adding material originally written by @bct737 on variable expansion in the shell.