[TxMt] how to concatenate templates ?

Roberto Saccon rsaccon at gmail.com
Sun Nov 11 02:49:22 UTC 2007


I have the default main template "template_in.txt"  and additionally
several License.txt templates. Based on a environment variable, I want
to concatenate the license with the main template, but I don't know
how

this is the default command to insert a template:

if [[ ! -f "$TM_NEW_FILE" ]]; then
   TM_YEAR=`date +%Y` \
   TM_DATE=`date +%Y-%m-%d` \
   TM_USERNAME=`niutil -readprop / /users/\$USER realname` \
   perl -pe 's/\$\{([^}]*)\}/$ENV{$1}/g' \
      < template_in.txt > "$TM_NEW_FILE"
fi


I tried to to turn it into somethng like this:


if [[ ! -f "$TM_NEW_FILE" ]]; then
   TM_YEAR=`date +%Y` \
   TM_DATE=`date +%Y-%m-%d` \
   TM_USERNAME=`niutil -readprop / /users/\$USER realname` \
   perl -pe 's/\$\{([^}]*)\}/$ENV{$1}/g' \
      < template_in.txt << License.txt > "$TM_NEW_FILE"
fi

unfortunately this doesn't work.

Anybody an idea how I can make this work ?

regards
-- 
Roberto Saccon
http://rsaccon.com



More information about the textmate mailing list