🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# B.19 ExecTask Executes a shell command. You can use this to quickly add a new command to Phing. However, if you want to use this regularly, you should think about writing a Task for it. Table B.19:聽Attributes NameTypeDescriptionDefaultRequired`command``String`The command that is to be executed.n/aOne of the two`executable``String`The command to execute without any command line arguments.n/a`dir``String`The directory the command is to be executed in.n/aNo`output``String`Where to direct stdout.n/aNo`error``String`Where to direct stderr.Redirected to stdout, unless `passthru` is set to true.No`os``String`Only execute if the [Appendix聽A](apa.html "Appendix A. Fact Sheet") property contains specified text.n/aNo`osfamily``String`OS family as used in the <os> condition.n/aNo`escape``Boolean`By default, we escape shell metacharacters before executing. Setting this to false will disable this precaution.`false`No`passthru``Boolean`Whether to use PHP's passthru() function instead of exec().`false`No`logoutput``Boolean`Whether to log returned output as MSG\_INFO instead of MSG\_VERBOSE.`false`No`spawn``Boolean`Whether to spawn unix programs to the background, redirecting stdout.`false`No`returnProperty``String`Property name to set return value to from exec() call.n/aNo`outputProperty``String`Property name to set output value to from exec() call.n/aNo`checkreturn``Boolean`Whether to check the return code of the program, throws a BuildException when returncode != 0.`false`No`level``String`Control the level at which status messages are reported. One of `error`, `warning`, `info`, `verbose`, `debug`.`verbose`No B.19.1 Examples ``` <!-- List the contents of "/home". --> <exec command="ls -l" dir="/home" /> <!-- Start the make process in "/usr/src/php-4.0". --> <exec command="make" dir="/usr/src/php-4.0" /> <!-- List the contents of "/tmp" out to a file. --> <exec command="ls -l /tmp > foo.out" escape="false" /> ``` B.19.2 Supported Nested Tags - `arg` Table B.20:聽Attributes NameTypeDescriptionDefaultRequired`value``String`A single command-line argument; can contain space characters. To pass an empty argument, enclose two double quotes in single quotes ('""').n/aOne of these`file``String`The name of a file as a single command-line argument; will be replaced with the absolute filename of the file.n/a`path``String`A string that will be treated as a path-like string as a single command-line argument; you can use ; or : as path separators and Phing will convert it to the platform's local conventions.n/a`line``String`A space-delimited list of command-line arguments.n/a`escape``Boolean`Force escape for this attribute.`false`聽