Didn't know what section this belonged in, so I'm posting here. Feel free to move if there is a more appropriate section.

I am hoping to be able to use ant to generate shell scripts and batch files for running non-ant compile and run tasks on a project

Basically, I have some projects that are sample code for using a library I wrote. I would like to distribute these examples with scripts that can be run to easily compile and run the project, without using ant.

ideally, I would like to create an ant target that when run would generate these script files for the current project. Could this be accomplished by having ant read a template script, and replace var names with their values? If so, how could I accomplish this?

Example script templates I'm hoping to be able to use:

build.sh:

Code:

#!/bin/bash

javac -cp ${classpath} -d ./build @./resources/sources.mf

run.sh:

Code:

#!/bin/bash

java -cp ${classpath} ${main.class} $@

Is there a way to have ant read in something like this, replace variables with values, and write out the finished script file?