0
我有這個簡單的PHP腳本PHP調用bash的問題
<?php
echo '<pre>';
// Outputs all the result of shellcommand "ls", and returns
// the last output line into $last_line. Stores the return value
// of the shell command in $retval.
$last_line = $output = system ("~/public_html/cgi-bin/srch.sh &> ~/public_html/errors.txt",$retval);
// Printing additional info
echo '
</pre>
<hr />Last line of the output: ' . $last_line . '
<hr />Return value: ' . $retval;
?>
依賴於srch.sh:
#!/bin/bash
for i in ~/mail/home/user/mail/domain.com/josh/cur/*
do
grep -i Value $i . &> ~/public_html/yesno.txt;
done
然而,所有這些都是在B rowser顯示RETVAL 1,沒有錯誤被記錄到任一文本文件中。我是否錯誤地混合了stderr和stdout,或者錯過了其他的東西?
我在沒有shell訪問權限的共享服務器上,必須通過上傳並通過瀏覽器運行,所以我無法直接運行它。絕對沒有任何內容存儲在errors.txt中 – 2009-01-21 14:02:18