Re: dump list of variables

pottmi@xxxxxxxxx wrote:
I am using bash 3.x and would like a way to one of the following:

1) error if a variable is used that is not declared. (set -o

One way this is done is with the special expansion syntax:


If the parameter is not set, then an error message containing word is
displayed. Modify that to :? to check for the parameter being null or

OK, I already know that that does not exist, but

A quick scan of the bash 3.0 man page comes up with:

-u Treat unset variables as an error when performing parameter
expansion. If expansion is attempted on an unset variable, the shell
prints an error message, and, if not interactive, exits with a non-zero

Also, elsewhere it is documented that "nounset" is the same as "-u".

The error message betrays the Lisp background of whoever implemented

bash: x: unbound variable

Too bad that the shell has no better way to handle this than to bail

hopefully that gives you the idea of what I want.

I want static typechecking, classes with an object-store database,
first class functions and lexical closures, and a native compiler!


2) dump a list of variables.

Try "set" with no arguments.