<?php
$cmd = 'ls -lpas';
# Execute the shell command
$shellOutput = shell_exec($cmd . ' > /dev/null; echo $?');
# Return execute status;
echo trim($shellOutput);
?>
Solution 2:
$cmd = 'echo hi';
my_runShellCmd($cmd);
function my_runShellCmd($cmd) {
return trim(shell_exec($cmd . ' > /dev/null; echo $?')) === '0' ? TRUE : FALSE;
}
No comments:
Post a Comment