I want to list the permission of every script in directory dir/bin. But the below command only runs "ls" in the directory where the script is with below code rather than every script in dir/bin. Since script.xml is there in maindir, it just does a ls inside maindir.
There are 2 problems:
- Performing
ls -l& not just the 1st command in the line - Performing
ls -lin right directory instead of directory where the script is.
The directory structure:
- maindir
- dir
-bin
-test.sh
-con.py
- script.xml
Below code is called "script.xml":
<foreach param="dirSc" in="dir/bin">
<exec executable="/bin/sh"
resultproperty="returncode"
output="dir/output.txt">
<arg value="-c" />
<arg line="ls -l ${dirSc}" />
</exec>
<foreach>
I suggest using the apply task to run commands against a series of files.
Example
Produces the following output
build.xml