Hats has raised an important point (which I'd come across myself in the mean time): Due to the use of double-quotes the current shell (of user 'tc') evaluates the variables first, before it "hands over" the results to the 'echo' command. But I believe the following shows that using single-quotes eliminates this effect (I've made a small amendment to show which process does the variable evaluation):tc@box:~$ echo "PID=$$" ; su -c "echo \"PID=$$ ICONS=$ICONS ENV=$ENV BACKUP=$BACKUP DESKTOP=$DESKTOP\"" tc
PID=1152
PID=1152 ICONS=wbar ENV=/home/tc/.ashrc BACKUP=1 DESKTOP=flwm_topside
tc@box:~$ echo "PID=$$" ; su -c 'echo PID=$$ ICONS=$ICONS ENV=$ENV BACKUP=$BACKUP DESKTOP=$DESKTOP' tc
PID=1152
PID=11010 ICONS=wbar ENV=/home/tc/.ashrc BACKUP=1 DESKTOP=flwm_topside
So that aside back to the original difference between what I was doing and what bigpcman did: He was not completely "honest" with us by not telling us that those commands were run from a shell started with sudo sh. Only the root@testbox:/home/tc# prompt revealed that fact, but was unknown until reply #14. There are obviously differences in the environments of a shell run by user 'tc' and one started with sudo sh or sudo su. This becomes clear when comparing the output of the commands env and set in each of those shells. Please note that sudo su operates in the 'root' user home directory which is '/root'.
Likewise if one would check the initial shell from which the X server was started from (e.g. using the key combination of "Ctrl-Alt-F1") one would find that this shell has also no ICONS defined. Any shell started from within the GUI will have the variable defined, as the variable was presumably set (and exported) by the execution of startx.
Finally, I tend to agree that that the "old way" of using '/etc/sysconfig/icons' as the source of the information looks "safe", compared to relying on the variable inheritance between processes.