On Fri, 2006-01-13 at 11:02 +1300, Grant Jacobs wrote:
> I'll be closing this unless I can see leads soon as I'm pretty much 
> out of time and I'll be unsubscribing when I'm done.

That is fine do what you have to do...

please read on...

> As you can see, I really do "just need the command line"! It strikes 
> as one of those things that'll be obvious to the right person or it 
> just can't be done. (I realise this is only partial traceability, but 

OK so this is to say:

$ phd.pl echo -n How am I going to get all this information to appear 

is the ENTIRE command that you enter to run you program and you want all
that information to be able to appear on the screen? 

Would that be a fair assessment?
or do you want it to display the $ as well?  Since that is a shell
defined value and can be altered by changing the value of PS1, I do not
think you can trap that. (issue a on Linux say ps -elf Sem ww what do
get?  Go to /proc/<PID> and look at the file command line of any given
program that is what is known and can be displayed.

> Lief, no, you're joining JupiterHost in misreading my posts (!): 
> command *line*, not *command*. It is a bit subtle, but its also the 

NOW all you want is the command line and it does not include special
characters ";" or "|" or "\" or IO redirection characters "<" or ">" You
need to give me your PHD.  IF you want to include those special
characters you still need to give me your PHD.

Again if what I am stating above is accurate you need to re-read you
Perl book...  2nd Edition page 138...  See $0 for the command name.

$ cat this.pl
#!/usr/bin/perl -Tw
use strict;

my $value_line = $#ARGV;


print "\nThe number of items entered is $value_line\n";
print "The command you entered is @ARGV\n";
print "The entire command entered is: $0 @ARGV\n";

$ ./this.pl

The number of items entered is -1
The command you entered is
The entire command entered is: ./this.pl
$ ./this.pl This is a test to see what the program will take in as input
for OUR PHD friend in .nz

The number of items entered is 19
The command you entered is This is a test to see what the program will
take in as input for OUR PHD friend in .nz
The entire command entered is: ./this.pl This is a test to see what the
program will take in as input for OUR PHD friend in .nz

So is part of the problem that you are trying to capture the command
line an include the special characters?  Sorry I deleted the original
post?   

Remember the special characters ";" or "|" or "<" or ">" or "\" If you
are trying to read past the semicolon ';' or past the | 'pipe' those are
UNIX special characters, and will be ignored by your program because
they have special meaning to the OS. (Get a UNIX book if you do not know
what that is.)  So if you are trying to trap that information you are
out of luck AFAIK...

If you are trying to trap and show the line extender \ you are out of
luck AFAIK as well...

$ ./this.pl this is a test of the program again however after the word
again I had "\\" to extend the line

The number of items entered is 19
The command you entered is this is a test of the program again however
after the word again I had \ to extend the line
The entire command entered is: ./this.pl this is a test of the program
again however after the word again I had \ to extend the line

Here is some more proof that commands that follow the ; and the | are
ignored..

$ ./this.pl This is a test of the program ; date | more 
The number of items entered is 6
The command you entered is This is a test of the program
The entire command entered is: ./this.pl This is a test of the program
$ ps -ef ww| grep this
leif     14037  2688 95 13:43 pts/1    R+     0:38 /usr/bin/perl
-Tw ./this.pl This is a test of the program
leif     14051 13980  0 13:44 pts/2    S+     0:00 grep this

$ pwd
/proc/14037
[EMAIL PROTECTED] 14037]$ cat cmdline
/usr/bin/perl-Tw./this.plThisisatestoftheprogram

To conclude if all you are looking for is the name of the program that
was run and you do not have the special characters it can be done in
PERL use my code as an example.  If you are trying to trap after the
special characters you need to re-write bash/ksh/tsch/sh/csh/ whatever
shell you choose.

-- 
Leif Ericksen <[EMAIL PROTECTED]>


-- 
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