Script Language Parser for Learning

I'm new to the UNIX world and have to learn scripting for my job. Presented with multiple scripts to learn (and then have to maintain in the future) is there a utility or process to input a script in it's native form and output what each line would look like fully parsed (i.e.: all variable names substituted with their values) WITHOUT executing the script. This way, I can look at the source code script and the end-result post-parsed output and learn by compaing the two.

Any help would be appreciated. Thanks.

You mean shell scripts, specifically? Look at sh -n -v -x or some subset of those switches. With -n it won't attempt to figure out the values of variables, either, though. In your typical nontrivial shell script, variable values are assigned highly dynamically so you really in practice do need to execute a script in order to see what's going on in the variables.

Thanks for such a quck respose. I can route (pipe) the output from this command via std err to a file so I can examine it. Right? And if I read the -x correctly, each line in the output would be the fully parsed line that would be executed (preceeded by a "+"). Right again?

Sorry if these are simplistic questions...

Try it so you won't have to ask (^: but yes.