PHP exec命令未与awk命令工作 [英] PHP exec command is not working with awk command
本文介绍了PHP exec命令未与awk命令工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下code:
$eff=40;
$pos=34;
$line=exec("tail $i.dssp -n $eff | awk -F" " -v var=$pos '{if ($2==var) print FNR}'");
请帮忙...
推荐答案
正如我在回答你的 previous提问时表示,您可以在里面使用单引号很容易解决这个问题。
As I said in my answer to your previous question, you can fix this easily by using single quotes on the inside.
PHP code
<?php
$eff=40;
$pos=34;
$i = 'hello';
$line=exec("tail $i.dssp -n $eff | awk -F' ' -v var=$pos '{if ($2==var) print FNR}'");
print "$line\n";
?>
采样输入( hello.dssp
)
foobar 34
示例输出:
1
这篇关于PHP exec命令未与awk命令工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文