• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 412
  • Last Modified:

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.
0
bsufs
Asked:
bsufs
1 Solution
 
ozoCommented:
`finger $user`
0
 
ecwCommented:
$res = `finger "$user"`;

0
 
shchukaCommented:
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.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
tim_lbiCommented:
You may use something like this:
open(F,"|/usr/bin/finger bla");
print STDOUT <F>;
close(F);

0
 
alamoCommented:
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/</&lt;/g;
0
 
tim_lbiCommented:
print STDOUT <F> was just an example.
while(<F>)
{ $_ =~ s/</&lt;/g; $_=~ s/>/&gt;/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
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now