in reply to Re^3: Catch the exact command line including the quotation marks and so on
in thread Catch the exact command line including the quotation marks and so on
OK. I ended up doing the following. It is not exact but it helps me build meaningful command (based on recommendations on http://stackoverflow.com/questions/6156742/how-can-i-capture-the-complete-commandline-in-perl). Double quote and single quote are just replaced by double quote.
But I still think perl should have a better way of catching the command line. It is bizarre that you can't simply get it exact!my $cmd = `ps -o args $$ | grep CJ.pl`; my @cmd = split(/\s/,$cmd); my $cmdline = "$cmd[0] "." $cmd[1]"; foreach (@ARGV) { $cmdline .= /\s/ ? " \"" . $_ . "\"": " " . $_; } print "$cmdline\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Catch the exact command line including the quotation marks and so on
by soonix (Chancellor) on Oct 24, 2015 at 17:49 UTC |