On Monday 29 October 2007 13:59, Bryen wrote:
> How do I get a complete listing of available variables in bash?

Do you mean variables with built-in meanings? In which case, Thomas' 
answer is the right one, though "help variables" gives you a short list 
right in the shell.

If you want to know which variables are currently defined, the "set" 
built-in command lists them. "help set" for a brief description or 
consult the man page for all the details.

I use this shell procedure (defined in my .bashrc) to query local 
variables:

vq () {
    set | egrep -e "$1"
}

This has to be a shell procedure since by definition local variables are 
not accessible in sub-shell and hence could not be displayed via a 
conventional script.


And I use this counterpart to query environment variables:

eq () {
    export | sed -n -e "/$1/ s/declare -x //p"
}

This one could be shell script, if you prefer.


> --
> ---Bryen---


Randall Schulz
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to