2018-01-03 14:43:27 -05:00

140 lines
4.2 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
<TITLE>Ant-contrib Tasks: ShellScript</TITLE>
<META NAME="GENERATOR" CONTENT="OpenOffice.org 644 (Linux)">
<META NAME="CREATED" CONTENT="20030313;10303100">
<META NAME="CHANGED" CONTENT="20030318;15221000">
</HEAD>
<BODY LANG="en-US" DIR="LTR">
<H1>ShellScript</H1>
<P>Task definition for the <CODE>shellscript</CODE> task. This task
allows the user to execute a script against a particular shell
program on a machine. It is an extension of the &quot;exec&quot;
task, and as such, supports the same attributes. One can however use
&quot;shell&quot; instead of &quot;executable&quot;. Also the
&quot;command&quot; attribute is not allowed. See the ANT
documentation for a description of the &lt;exec&gt; task parameters.</P>
<H2>Parameters</H2>
<TABLE WIDTH=854 BORDER=1 CELLPADDING=2 CELLSPACING=0>
<COL WIDTH=84>
<COL WIDTH=670>
<COL WIDTH=86>
<TR>
<TH WIDTH=84>
<P>Attribute</P>
</TH>
<TH WIDTH=670>
<P>Description</P>
</TH>
<TH WIDTH=86>
<P>Required</P>
</TH>
</TR>
<TR>
<TD WIDTH=84 VALIGN=TOP>
<P>shell</P>
</TD>
<TD WIDTH=670 VALIGN=TOP>
<P>The name of the shell executable which is to be executed. This
shell must support taking a single parameter whose value is a
script file which is to be executed.
</P>
</TD>
<TD WIDTH=86>
<P>Yes</P>
</TD>
</TR>
<TR>
<TD WIDTH=84 VALIGN=TOP>
<P>executable</P>
</TD>
<TD WIDTH=670 VALIGN=TOP>
<P>Same as “shell”</P>
</TD>
<TD WIDTH=86>
<P><BR>
</P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD WIDTH=84>
<P>tmpsuffix</P>
</TD>
<TD WIDTH=670>
<P>The contents of the script are placed in a temporary file. This
attribute is the extension to use. <B>note: </B>The value must
contain any dots required. This attribute is usefull for using
script files with windows
</P>
</TD>
<TD WIDTH=86>
<P>No</P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD WIDTH=84>
<P>inputstring</P>
</TD>
<TD WIDTH=670>
<P>This is placed in the script file.</P>
</TD>
<TD WIDTH=86>
<P>No</P>
</TD>
</TR>
</TABLE>
<H2>Nested Text</H2>
<P>Any nested text is treated as the contents of the script that is
to be executed within the shell. Embedded ant properties will be
converted.</P>
<H2>Examples</H2>
<PRE> &lt;shellscript shell=&quot;bash&quot; dir=&quot;${src.mib.dir}&quot;&gt;
mibgen -i ../include mib.mib -c ${build.gen.dir}/generated.cpp
mibgen -i ../include mib.mib -h ${build.gen.dir}/generated.h
&lt;/shellscript&gt;
&lt;shellscript shell=&quot;sed&quot; outputproperty=&quot;sed.output&quot;&gt;
&lt;arg value=&quot;-e&quot;/&gt;
&lt;arg value=&quot;s/FOO/BAR/g&quot;/&gt;
FOO bar bar bar FOO bar bar
&lt;/shellscript&gt;
&lt;shellscript shell=&quot;cmd.exe&quot; tmpsuffix=&quot;.bat&quot;&gt;
&lt;arg value=&quot;/c&quot;/&gt;
&lt;arg value=&quot;call&quot;/&gt;
echo hello world
&lt;/shellscript&gt;
&lt;shellscript shell=&quot;bash&quot;
dir=&quot;${build.bin.dir}&quot;
inputstring=&quot;ls -rt | tail -n 1&quot;
outputproperty=&quot;last.bin.file&quot;/&gt;
&lt;shellscript executable=&quot;perl&quot;&gt;
print STDOUT &quot;Hello World!\n&quot;;
&lt;/shellscript&gt;
&lt;shellscript shell=&quot;sh&quot; dir=&quot;${thirdparty.dist.dir}/lib&quot;&gt;
rm *.so
for file in *.0
do
x=`echo $file | sed -e's/.0.1.0//'`
ln -s $file $x
done
&lt;/shellscript&gt;</PRE><P>
<BR><BR>
</P>
<P><B>Warning:</B></P>
<P STYLE="margin-left: 0.79in">One should be carefull in using
<I>shellscript</I>, as overuse will make your build files difficult
to understand, to maintain and to support multiplatform builds. Use
of <I>cygwin</I> in a windows environment will help. However one
should strive to use the java tasks whereever possible.</P>
<PRE STYLE="margin-bottom: 0.2in"> </PRE>
<HR>
<P ALIGN=CENTER>Copyright &copy; 2003 Ant-Contrib Project. All rights
Reserved.</P>
</BODY>
</HTML>