「標準」サイトからサイトを作成するために使用されるphpスクリプトを書いています。UNIXシェルコマンドはたくさんありますが、エラーの表示に問題があることがわかりました。
例:サイトフォルダがまだ存在しないことを確認する必要があります。
$ls_newsite = exec('ls /vhosts/'.$sitename, $output, $error_code);
if ($error_code == 0) {
Shell::error('This site already exists in /vhosts/');
}
Shell::output(sprintf("%'.-37s",$sitename).'OK!');
なので、エラーは処理できますが、とにかく表示されます。
php shell.php testing.com
Checking site...
ls: cannot access /vhosts/testing.com: No such file or directory
testing.com.................................OK!
表示を防ぐにはどうすればよいですか?ありがとう