#!/usr/bin/php $last, 'login' => "\e[95m", 'warn' => "\e[93m", 'error' => "\e[91m", 'system' => "\e[96m", 'array' => "\e[92m"]; $call = ['tail','docker']; if (!in_array($argv[1],$call)) exit; array_shift($argv); $cmd = popen(implode(' ',array_map('escapeshellarg',$argv)),'r'); while (($line = fgets($cmd))!==false) { $lead = $last; foreach ($match as $type) foreach ($type['text'] as $text) { if (preg_match("/$text/i",$line)) { $lead = $color[$type['class']]; break 2; } } echo $lead,rtrim($line,"\n"),$last,"\n"; } pclose($cmd); ?>