I am trying to run some strace command as follows:
my @cmd = shell_quote(@ARGV);
strace -f -o trace.log -e trace=file @cmd
I want to go over the trace.log and parse it while it is running and also print the @cmd stdout to the screen.
Any idea how I should do that ... HELP :)
sub shell_unquote {
my @strings = (@_);
my $arg;
for my $arg (@strings) {
if(not defined $arg) {
$arg = "";
}
$arg =~ s/'\n'/\n/g; # filenames with '\n' is quoted using \'
$arg =~ s/\\([\002-\011\013-\032])/$1/g;
$arg =~ s/\\([\#\?\`\(\)\{\}\*\>\<\~\|\; \"\!\$\&\'])/$1/g;
$arg =~ s/\\\\/\\/g;
}
return wantarray ? @strings : "@strings";
}