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.