bsufs
asked on
finger command
Is it possible to send a finger command via a Perl script? What I'd like to do is send the command and then display the results in a web browser.
`finger $user`
$res = `finger "$user"`;
If you want a really technical question, you can open the socket connection to the
intended host, send a query, receive a reply and display it. This way you can customize the error messages. Finger port is 79.
intended host, send a query, receive a reply and display it. This way you can customize the error messages. Finger port is 79.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Doesn't
open(F,"|/usr/bin/finger bla");
open a pipe *to* finger (which is wrong), not a pipe from finger to capture its results?
Not to mention that
print STDOUT <F>;
is a bad way to print the results of the finger to the browser, since the results could contain characters such as < > and & which have special meanings in html and thus need to be translated into the html equivalents, e.g.
$res =~ s/</</g;
open(F,"|/usr/bin/finger bla");
open a pipe *to* finger (which is wrong), not a pipe from finger to capture its results?
Not to mention that
print STDOUT <F>;
is a bad way to print the results of the finger to the browser, since the results could contain characters such as < > and & which have special meanings in html and thus need to be translated into the html equivalents, e.g.
$res =~ s/</</g;
print STDOUT <F> was just an example.
while(<F>)
{ $_ =~ s/</</g; $_=~ s/>/>/g; print "Line: $_"; }
You may do what you want with the output...
The part with 'pipe to finger' is a bit strange...What you write to F is STDIN on finger, and what you read from F is STDOUT of finger. The pipe is 2 way communication...
Tim
while(<F>)
{ $_ =~ s/</</g; $_=~ s/>/>/g; print "Line: $_"; }
You may do what you want with the output...
The part with 'pipe to finger' is a bit strange...What you write to F is STDIN on finger, and what you read from F is STDOUT of finger. The pipe is 2 way communication...
Tim