WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Set Aliases for Ondemand Extensions  (Read 111 times)

Offline CNK

  • Wiki Author
  • Sr. Member
  • *****
  • Posts: 387
Set Aliases for Ondemand Extensions
« on: October 09, 2025, 03:11:59 AM »
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:

Code: [Select]
# 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.