info locals

info locals ?pattern?

If pattern isn't specified, returns a list of all the names of currently-defined local variables, including arguments to the current procedure, if any. Variables defined with the global, upvar and variable commands will not be returned. If pattern is specified, only those names matching pattern are returned. Matching is determined using the same rules as for string match.