Since most folks bottom post here see the bottom for my answer to this problem.
On Thu, 2006-01-12 at 15:48 +1300, Grant Jacobs wrote: > Sorry for the repeat posting, that's NOT solved. > > >(Excuse the long post.) > > > >Unless I'm missing something, this doesn't do what I wanted. I want > >is the whole command *line*, not the portion of it that evoked the > >script, the latter being the individual *command* within the command > >line--confusing enough ;-) ? If I issue the example I gave in my OP: > > > > 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" > >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, 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? 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 :-( > > > > > >(I know bash 3.0+ has a BASH_COMMAND env. var. and I'm looking into > >installing a bash 3.0.x alongside Apple's 2.05b btw, but it'd be > >nicer to have a solution that's not tied to a particular shell or > >version.) > > > > > >Thanks, > > > > > >Grant > > > >>Grant Jacobs wrote: > >> > >>>Item: Obtaining complete Unix command line that evoked script as a string > >> > >>use Unix::PID; > >> > >>my $pid = Unix::PID->new(); > >>print 'The kernel says I am: ' . $pid->get_command($$); > >> > > > >-- > >------------------------------------------------------------------- > >Grant Jacobs Ph.D. BioinfoTools > >ph. +64 3 478 0095 (office, after 10am) PO Box 6129, > >or +64 27 601 5917 (mobile) Dunedin, > >[EMAIL PROTECTED] NEW ZEALAND. > > Bioinformatics tools: deriving knowledge from biological data > >Bioinformatics tools - software development - consulting - training > > 15 years experience in bioinformatics ready to solve your problem > >Check out the website for more details: http://www.bioinfotools.com > > > >The information contained in this mail message is confidential and > >may be legally privileged. Readers of this message who are not the > >intended recipient are hereby notified that any use, dissemination, > >distribution or reproduction of this message is prohibited. If you > >have received this message in error please notify the sender immed- > >iately and destroy the original message. This applies also to any > >attached documents. > > > >-- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > ><http://learn.perl.org/> <http://learn.perl.org/first-response> > > > -- > ------------------------------------------------------------------- > Grant Jacobs Ph.D. BioinfoTools > ph. +64 3 478 0095 (office, after 10am) PO Box 6129, > or +64 27 601 5917 (mobile) Dunedin, > [EMAIL PROTECTED] NEW ZEALAND. > Bioinformatics tools: deriving knowledge from biological data > Bioinformatics tools - software development - consulting - training > 15 years experience in bioinformatics ready to solve your problem > Check out the website for more details: http://www.bioinfotools.com > > The information contained in this mail message is confidential and > may be legally privileged. Readers of this message who are not the > intended recipient are hereby notified that any use, dissemination, > distribution or reproduction of this message is prohibited. If you > have received this message in error please notify the sender immed- > iately and destroy the original message. This applies also to any > attached documents. > Sounds to me like he is trying to have is program understand a LONG string of options... i.e your command master> myperl.pl c1 c2 c3 c4 c5 ... c15 This might be best solved using @ARGV Camel book second edition page 138 @ARGV The array containing the command-line arguments intended for the script. Note that $#ARGV is generally the number of arguments minus 1... Arrays start at 0 this the minus 1. -- Leif Ericksen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>