Class it:
/**
* Construct shell command using it::shell_command, log it, execute it and return output as string.
* {keyword} quotes and inserts value from assoc array like ET()
* {0} .. {n} quotes and inserts positional arguments
* {-opts} array of opts => {value,true,false,null}: it::exec('ls {-opts}', ['-opts' => ["-l" => true]]);
* @param $cmd Format string with {keywords} a la ET()
* @param $args varargs, contains key => val arrays for filling in cmd line. val=null expands to nothing
* @return output of command. shell errors not detectable, consider it::system or see /www/server/log/error_log
*/
static function exec($cmd, ...$args)
{
$cmd = it::shell_command($cmd, ...$args);
$before = gettimeofday(true);
$result = EDC('noexec') ? "" : (string)shell_exec("set +o posix\n" . $cmd);
@it::log('exec', round((gettimeofday(true) - $before)*1000) . "\t$cmd");
return $result;
}