net.sf.antcontrib.platform

Class ShellScriptTask


public class ShellScriptTask
extends ExecTask

A generic front-end for passing "shell lines" to any application which can accept a filename containing script input (bash, perl, csh, tcsh, etc.). see antcontrib doc for useage
Authors:
stephan beal
peter reilly

Method Summary

void
addText(String s)
Adds s to the lines of script code.
void
execute()
execute the task
void
setCommand(Commandline notUsed)
Disallow the command attribute of parent class ExecTask.
void
setExecutable(String shell)
Sets the shell used to run the script.
void
setInputString(String s)
Sets script code to s.
void
setShell(String shell)
Sets the shell used to run the script.
void
setTmpSuffix(String tmpSuffix)
Sets the suffix for the tmp file used to contain the script.
protected void
writeScript()
Writes the script lines to a temp file.

Method Details

addText

public void addText(String s)
Adds s to the lines of script code.

execute

public void execute()
            throws BuildException
execute the task

setCommand

public void setCommand(Commandline notUsed)
Disallow the command attribute of parent class ExecTask. ant.attribute ignore="true"
Parameters:
notUsed - not used

setExecutable

public void setExecutable(String shell)
Sets the shell used to run the script.
Parameters:
shell - the shell to use (bash is default)

setInputString

public void setInputString(String s)
Sets script code to s.

setShell

public void setShell(String shell)
Sets the shell used to run the script.
Parameters:
shell - the shell to use (bash is default)

setTmpSuffix

public void setTmpSuffix(String tmpSuffix)
Sets the suffix for the tmp file used to contain the script. This is useful for cmd.exe as one can use cmd /c call x.bat
Parameters:
tmpSuffix - the suffix to use

writeScript

protected void writeScript()
            throws BuildException
Writes the script lines to a temp file.