echo -n "Starting..." ; more some-stuff | \
    doStuff.pl - 3 > save-here.out ; echo "done."

Within doStuff.pl I want to obtain the command line, i.e. everything from "echo" through to '"done."', or at least everything from "more"

I think you may need to rethink your goal and try a different approach.

What purpose is served by getting that info? Perhaps that goal can be reached another way...

through to "save-here.out". (As I wrote in my OP: "everything including pipes and redirects, etc.") Its the reason I gave this extended example command line as an example, including it spanning lines.

PID->get_command() gives me just the script and it parameters. That is,

Unix::PID :)

it gives the command, not the command line.

Trying to get Unix::PID to give the command of the ppid, yields '-bash' (let's hope I'm doing things right!), so I presume that the command *line* isn't considered a unit in this scheme of things--? Put another way, the example above would yield five commands, each whose parent is '-bash' and the command *line* isn't retained in the PID hierarchy?

probably so, see below.

This makes sense to me in that lines aren't processes are such, so I can imagine the shell splitting into the five piece, but it'd also mean that Unix::PID is very unlikely to be any use to me :-(

that means the kernel doesn't have a way I imagine:

$ echo "Fooo" | perl -MUnix::PID -le ' print Unix::PID->new()->get_command($$);'
perl -MUnix::PID -le  print Unix::PID->new()->get_command($$);
$

$ perl -le 'print `ps aux|grep $$`;'
joemama 641 3.3 0.1 27272 460 p1 S+ 10:15PM 0:00.01 perl -le print `ps aux|grep $$`; joemama 642 0.4 0.1 27820 608 p1 S+ 10:15PM 0:00.01 sh -c ps aux|grep 641 joemama 644 0.0 0.0 27820 4 p1 R+ 10:15PM 0:00.00 grep 641
$

HTH :)

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to