Solved

finger command

Posted on 1998-08-03
6
408 Views
Last Modified: 2012-06-27
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
Comment
Question by:bsufs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1208978
`finger $user`
0
 
LVL 5

Expert Comment

by:ecw
ID: 1208979
$res = `finger "$user"`;

0
 
LVL 2

Expert Comment

by:shchuka
ID: 1208980
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Accepted Solution

by:
tim_lbi earned 200 total points
ID: 1208981
You may use something like this:
open(F,"|/usr/bin/finger bla");
print STDOUT <F>;
close(F);

0
 
LVL 6

Expert Comment

by:alamo
ID: 1208982
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
 
LVL 1

Expert Comment

by:tim_lbi
ID: 1208983
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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question