Samstag, 16. Mai 2015

Todays achievement

I'm trying to provide some information on the variables used by TUI, reading them from 'memory' as env doesnt list them anymore (since heartbleed, still accessable by "echo ...").

Anyway, so me kind of proud this worked on first attempt :)
List all the variables starting with TUI_ and RET_:
echo ${!TUI_*} ${!RET_*}
While this is already nice, as it prints all variable names starting with either TUI_ or RET_, i'd like to show the values of these variables as well, so the user gets an idea what to expect.
Thought, eval might be usefull at this point, to show the current set paths, files, colors and default return values.

for foundVar in ${!TUI_*} ${!RET_*}
do    tui-printf -E \
           "$foundVar" \
           "$(tmp=\$$foundVar ; printf '%s' $(eval echo $tmp))"
done

Which then finaly printed (shortened):
:: TUI_DIR_CACHE                     /home/sea/.cache ::
:: TUI_DIR_CONF                              /etc/tui ::
:: TUI_DIR_DOCS                    /usr/share/doc/tui ::
:: TUI_DIR_INSTALL_ROOT                               ::
:: TUI_DIR_SYSTEM                      /usr/share/tui ::
:: TUI_DIR_THEMES               /usr/share/tui/themes ::
:: TUI_DIR_USER                 /home/sea/.config/tui ::
:: TUI_DIR_USER_LOGS       /home/sea/.config/tui/logs ::
:: TUI_DIR_USER_MANPAGES    /home/sea/.local/man/man1 ::
:: TUI_DIR_USER_SCRIPTS          /home/sea/.local/bin ::

Keine Kommentare: