Use the env command. The env command returns a list of all global variables that have been defined. If a global variable exists in a script that hasn’t been run yet, it will not show up in the output from env.
Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License