Installing terminal-based programs "ondemand" never worked that well for me. On first run the terminal prompt doesn't return until you press enter, and many interactive terminal programs refuse to run entirely from within the ondemand script.
Adding this to ~/.ashrc converts the ondemand scripts into aliases, and I've found it works much better:
# Turn ondemand scripts into aliases for better compatibility with
# interactive terminal programs
for file in /etc/sysconfig/tcedir/ondemand/*
do
ext="`expr \"\`cat $file\`\" : '.* \([^ ]*\)\.tcz'`"
cmd=${file##*/}
alias $cmd="[ -e /usr/local/tce.installed/$ext ] || { tce-load -i $ext; hash -r; }; $cmd"
done
Note that any aliases that define default command-line arguments for ondemand commands must be set after this part in ~/.ashrc otherwise they will be overridden by it.