Solved

finger command

Posted on 1998-08-03
6
402 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
6 Comments
 
LVL 84

Expert Comment

by:ozo
Comment Utility
`finger $user`
0
 
LVL 5

Expert Comment

by:ecw
Comment Utility
$res = `finger "$user"`;

0
 
LVL 2

Expert Comment

by:shchuka
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Accepted Solution

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

0
 
LVL 6

Expert Comment

by:alamo
Comment Utility
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
Comment Utility
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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now