[Solved] PHP exec command is not working with awk command [closed]


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";
?>

Sample Input (hello.dssp):

foobar 34

Sample Output:

1

solved PHP exec command is not working with awk command [closed]