1#! /usr/bin/awk -f 2 3BEGIN { 4 print "# This file is autogenerated from commands.txt. Do not edit" 5 cmdstring = "export CMDS=\"" 6 cmdch = 1 7 cmd_idx=0 8} 9 10# Strip comments 11{ 12 gsub(/#.*/, "", $0) 13} 14 15# Strip blank lines 16/^[ ]*$/ { 17 next 18} 19 20# Process remaining lines 21{ 22 gsub(/%%STFSUITEDIR%%/, stfsuitedir, $1) 23 fullcmd = $1 24 cmdname = $1 25 gsub(/.*\//, "", cmdname) 26 CMDNAME = toupper(cmdname) 27 allcmds[cmd_idx] = CMDNAME 28 cmd_idx += 1 29 printf "export %s=\"%s\"\n", CMDNAME, fullcmd 30} 31 32# Print CMDS 33END { 34 print "" 35 printf "export CMDS=\"" 36 for (idx in allcmds) 37 printf "$%s ", allcmds[idx] 38 print "\"" 39} 40