So, not being smart enough to write proper shell scripts means one has to learn C++. q:
BTW, the script currently looks like this, showing an extra dmenu while generating the list of tczs to prevent confusion.
#!/bin/sh
[ -e "/usr/local/tce.installed/dmenu" ] || tce-load -i dmenu.tcz >/dev/null 2>&1
cd /etc/sysconfig/tcedir/optional
TCZS="$(ls -1 *.tcz 2>/dev/null | sed 's/.tcz$//g' | sort -f)"
cd /usr/local/tce.installed
echo "Building menu..." | dmenu -b -w 300 -h 300 -y 19 -p "*.tcz" -i -xs -nb '#0D0D0C' -nf '#D4D0C8' -sb '#050503' -sf '#ffb000' >/dev/null 2>&1 &
for i in * ; do TCZS="$(echo "${TCZS}" | sed "s/^\b$i\b$/:: $i/")" ; done
killall dmenu
tce-load -i $(echo "$TCZS" | dmenu -b -w 300 -h 300 -y 19 -c -p "*.tcz" -i -xs -nb '#0D0D0C' -nf '#D4D0C8' -sb '#050503' -sf '#ffb000') >/dev/null 2>&1 &
Having 517 tczs on 7.x it takes about one second on my netbook. My 6.x install has 1139 tczs.
I just can't find a way to batch-replace several strings without a for loop and echo, which I think is the main for the delay.