1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
<!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 "exec"
task, and as such, supports the same attributes. One can however use
"shell" instead of "executable". Also the
"command" attribute is not allowed. See the ANT
documentation for a description of the <exec> 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> <shellscript shell="bash" dir="${src.mib.dir}">
mibgen -i ../include mib.mib -c ${build.gen.dir}/generated.cpp
mibgen -i ../include mib.mib -h ${build.gen.dir}/generated.h
</shellscript>
<shellscript shell="sed" outputproperty="sed.output">
<arg value="-e"/>
<arg value="s/FOO/BAR/g"/>
FOO bar bar bar FOO bar bar
</shellscript>
<shellscript shell="cmd.exe" tmpsuffix=".bat">
<arg value="/c"/>
<arg value="call"/>
echo hello world
</shellscript>
<shellscript shell="bash"
dir="${build.bin.dir}"
inputstring="ls -rt | tail -n 1"
outputproperty="last.bin.file"/>
<shellscript executable="perl">
print STDOUT "Hello World!\n";
</shellscript>
<shellscript shell="sh" dir="${thirdparty.dist.dir}/lib">
rm *.so
for file in *.0
do
x=`echo $file | sed -e's/.0.1.0//'`
ln -s $file $x
done
</shellscript></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 © 2003 Ant-Contrib Project. All rights
Reserved.</P>
</BODY>
</HTML>
|