#!/usr/local/bin/mscript
if($1 == ""){
}
int @count = 4;
mutable_primative @exitError = mutable_primitive(true);
subshell: false,
stdout: closure(@line){
'(\\d+) bytes from (.*) \\((.*)\\)(.*)',
'$1 bytes from &a$2 &r(&b$3&r) $4', @line));
if(reg_match('.*, 0% packet loss.*', @line)){
@error = 'a';
@exitError[] = false;
}
'(\\d) packets transmitted, (\\d) received, (\\d+% packet loss)(.*)',
'$1 packets transmitted, $2 received, &'.@error.'$3&r$4',
@line)
);
}
)
);
exit(if(@exitError, 1, 0));
Language: commandhelper
Posted by Anonymous at 10 Mar 2016, 09:48:31 UTC