I'm still not clear what you are trying to achieve by running something like
su -c CMD tc but I think your system is "playing up".
The extracts I provided yesterday were from the same system that I've used to produced the following:
tc@box:~$ version
tinycore_3.0alpha4
tc@box:~$ echo "ICONS=$ICONS ENV=$ENV BACKUP=$BACKUP DESKTOP=$DESKTOP"
ICONS=wbar ENV=/home/tc/.ashrc BACKUP=1 DESKTOP=flwm_topside
tc@box:~$ su -c "echo \"ICONS=$ICONS ENV=$ENV BACKUP=$BACKUP DESKTOP=$DESKTOP\"" tc
ICONS=wbar ENV=/home/tc/.ashrc BACKUP=1 DESKTOP=flwm_topside
tc@box:~$ sudo grep tc /etc/sudoers
tc ALL=(ALL) NOPASSWD: ALL
tc@box:~$ sudo -u tc echo "ICONS=$ICONS ENV=$ENV BACKUP=$BACKUP DESKTOP=$DESKTOP"
ICONS=wbar ENV=/home/tc/.ashrc BACKUP=1 DESKTOP=flwm_topside
If you don't get the same result try booting again with boot code "base norestore" to check your findings against a "plain" TC system.
Furthermore, ICONS is "controlled" by the following piece of code from '/etc/init.d/tc-config':
ICONS="wbar"
TCEWBAR="/usr/local/tce.wbar"
if [ -z "$NOICONS" ] && [ -f /usr/share/wbar/dot.wbar ]; then
echo "$ICONS" > /etc/sysconfig/icons
fi
As you can see the setting is stored in '/etc/sysconfig/icons' and is taken from there on occasion by other scripts.
Please note that '/etc/sysconfig/icons' contains pretty much all stuff related to boot codes and initial system setup. I highly recommend to grab yourself a cup of tea (or whatever else) and study this file and it's inter-working with other scripts really carefully. Since the shell under which all this gets executed has only fairly sparse
documentation I'd suggest to use
this one here instead.
I'm afraid this is all getting a bit off-topic (you might want to ask hats to split this thread) ...