Is there any way to find out the variables available in the scope of the shell script.
the scenario is like this, we are using some third party tools and we can customize the output with creating shell scripts with a particular naming convention. we know that certain parameters are being passed to our custom shell scripts but we want to know what else is being passed.
thanks.
The command is set
From the bash
manual page
set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
Without options, the name and value of each shell variable are displayed in a
format that can be reused as input.
Do not confuse this with env
which will print out the values of environment variables not shell variables. shell variables can be marked for automatic export into the environment of subsequent child processes using the export
command.
scope as a programming term, only really applies to shell variables - commands like typeset
and local
can be used in some shells (ksh
and bash
) to allow the use of scoped shell variables within functions. environment variables are global to a instance of a processes.
It's very easy ;)
env
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With