Expanding a globed variable name

Heyas

I'm trying to give some information on used variables.
While the first two work fine, the ones starting with a glob (is that the proper term?) fail.

echo ${!TUI_*} ${!RET_*} ${!*_CLI} ${!*\_GUI}
bash: ${!*_CLI}: bad substitution

Same with @ or have them escaped.

I found no indication for using suffix :frowning:

       ${!prefix*}
       ${!prefix@}
              Names  matching  prefix.  Expands to the names of variables whose names begin with prefix, separated
              by the first character of the IFS special variable.  When @ is used and the expansion appears within
              double quotes, each variable name expands to a separate word.

       ${!name[@]}
       ${!name[*]}
              List  of  array  keys.   If  name  is an array variable, expands to the list of array indices (keys)
              assigned in name.  If name is not an array, expands to 0 if name is set and null otherwise.  When  @
              is used and the expansion appears within double quotes, each key expands to a separate word.
       

Any ideas/advice please?

---------- Post updated at 16:02 ---------- Previous update was at 15:43 ----------

Nevermind, i'm reading out the files providing the variables to read the variable names, and evalute them to show what currently is in memory.

tui-printf -T "Variables provided by sourcing TUI (User specific)"
			
list=""
list+=" $(tui-conf-get -l $TUI_FILE_CONF_USER)"
list+=" $(tui-conf-get -l $TUI_FILE_CONF_APPS)"
list+=" $(tui-conf-get -l $TUI_FILE_CONF_SETTINGS)"

for foundVar in $list 
do	tui-printf -E \
		"$foundVar" \
		"$(tmp=\$$foundVar ; printf '%s' $(eval echo $tmp))"
done

Replace tui-printf -E by something like printf '%s\t\t%s\n'

/solved

EDIT:
Outputs like:

tui info
<....>
:: Variables provided by sourcing TUI (User specific) ::
:: USER_NAME                                      sea ::
:: USER_EMAIL              seaATlocalhost.localdomain ::
:: USER_HOMEPAGE                                      ::
:: DEFAULT_LICENSE       GNUGeneralPublicLicense(GPL) ::
:: TUI_THEME                                 dot-blue ::
:: EDITOR_GUI                               notepadqq ::
:: EDITOR_CLI                                    nano ::
:: BROWSER_CLI                                   lynx ::
:: BROWSER_GUI                                firefox ::
:: TERMINAL                                    termit ::
:: TAR_EXT                                     tar.gz ::
:: DD_BS                                           4M ::
:: CURLWGET                                      wget ::
:: TAR_EXT                                     tar.gz ::
:: DD_BS                                           4M ::
:: USER_SHELL                                    bash ::

How about ( bash ism?)

A_CLI=�jkb3brljv
B_CLI=12124

set | grep "^.*_CLI"
A_CLI=�jkb3brljv
B_CLI=12124
1 Like

Figured my method is simpler (for the current task), as i also (have to) provide some variable names that cannot follow a regular naming scheme.

Also, this way i dont have to rewrite the variable names (here) if i should change them (in the conf files).

Hope i recall this option at next occourence, thank you!