[TxMt] change the new file name

Samuel MORELLO samuel.morello at ouvanous.com
Tue Mar 8 13:27:53 UTC 2011


Hi,

Is it possible to add text before the filename when creating a new file
based on template.
I would like to create a jquery.$TM_NEW_FILE_BASENAME.js
I tried to modify the script below :

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


to something like this

if [[ ! -f "$TM_NEW_FILE_DIRECTORY/jquery.$TM_NEW_FILE_BASENAME.js" ]]; then
   TM_YEAR=`date +%Y` \
   TM_DATE=`date +%Y-%m-%d` \
   perl -pe 's/\$\{([^}]*)\}/$ENV{$1}/g' \
      < template_in.txt > "$TM_NEW_FILE_DIRECTORY/jquery.
$TM_NEW_FILE_BASENAME.js"
fi

The file is correctly created but not open instantly.

Many thanks for your help.

Regards,

Samuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20110308/59c6cb8b/attachment.html>


More information about the textmate mailing list