How to list the variables that are used in a script?
Is there a command that can list the variables that I am using in a script? I mean the variables that I created in the script not the environment or local variables. For example if I have a script that has the following var's like : name=Alex, age=20, postal_code=12345, how can I list them all @ once WITHOUT using echo $name, $age and so on. Imagine I have a lot of variables and i can't echo them all. Thanks
|
Dont know whether it will work, but a way may be to `env` at the beginning of the script to establish a baseline and then `env` later and `diff` them.
|
The set command lists all variables currently in scope. It could be used at the beginning of a script to list all the inherited variables (environment plus positional parameters) and then later; the difference between the lists would be the created variables.
|
All times are GMT -5. The time now is 05:42 AM. |