What I usually find myself doing with scripts like this amounts to doing manual abstract interpretation. Instead of executing the script, I open it in an editor, and trace through it.
Simple scripts may just be a list of commands to review, but more complex scripts often involve: