in reply to Getting a script's original command line
the following worked for me under Linux 2.2:
it still doesn't give you the exact command line though, just what was passed to exec. you would have to get the verbatim command line from the shell, and at least under BASH, it is not in %ENV.open CMDLINE, "/proc/self/cmdline"; print map { $_, $/ } <CMDLINE>; close CMDLINE;
update: Randal correctly noted that the arguments from /proc/self/cmdline are NUL-separated, so the following works better:
$/ = "\x000"; $\ = "\n"; open CMDLINE, "/proc/self/cmdline"; print for (<CMDLINE>); close CMDLINE;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: Getting a script's original command line
by merlyn (Sage) on Jun 16, 2000 at 20:40 UTC | |
|
RE: Re: Getting a script's original command line
by blackwolf (Sexton) on Jun 16, 2000 at 20:57 UTC |