echo names and values of all env variables that start with "nlu_setting"

for var in "${!nlu_setting_@}"; do
    printf '%s=%s\n' "$var" "${!var}"
done

The expansion ${!nlu_setting_@} is a bash-specific expansion that returns a list of variable names matching a particular prefix. Here we use it to ask for all names that start with the string nlu_setting_. We loop over these names and output the name along with the value of that variable.

We get the value of the variable using variable indirection (${!var}).


After looking at the answers to this question, I came up with this:

   compgen -A variable nlu_setting_ | while read v; do
            echo "$v = ${!v}";
   done

it seems to work. Never heard of the compgen command, but if it's universal bash built-in, it should be all good..