[英]Using named pipe including command on php syntax error
$ cat a.php
<?php
system("echo <(ls)");
this script.这个脚本。
$ php a.php
sh: 1: Syntax error: "(" unexpected
I execute the script.我执行脚本。 But a syntax error occered.
但是出现了语法错误。
$ echo <(ls)
/dev/fd/63
success on bash. bash 成功。 I dont know what to do.
我不知道该怎么办。
Welcome to StackOverflow!欢迎使用 StackOverflow!
sh: 1: Syntax error: "(" unexpected
This error typically comes up for non-bash shells, which don't support <()
expression pipes.此错误通常出现在不支持
<()
表达式管道的非 bash shell 中。 Even when sh is bash, it'll run in a compatibility more where process substitution is not available.即使当 sh 是 bash 时,它也会在更多的兼容性中运行,而进程替换不可用。
It will work fine with bash.它可以与 bash 一起正常工作。
$ echo <(ls)
/dev/fd/63
Script should always be run with bash with /bin/bash -c
.脚本应始终使用 bash 与
/bin/bash -c
一起运行。
system('/bin/bash -c "echo <(ls)"');
Via executable script.通过可执行脚本。
execute.sh执行文件
#!/bin/bash
echo <(ls)
a.php一个.php
<?php
exec('execute.sh');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.