Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Perl / November 2005



Tip: Looking for answers? Try searching our database.

Perl equivalent of who command?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
James Reynolds - 01 Nov 2005 19:14 GMT
Is there a Perl way to get the equivalent of the who shell command?
Output of the who command:

who
username 1 console  Nov  1 12:07
username2      ttyp1    Nov  1 12:09

I've been running the shell command in backticks, but if I can get a
Perl way, I would be much happier.

--

Thanks,

James Reynolds
University of Utah
Student Computing Labs
james@scl.utah.edu
801-585-9811
Jeremy Mates - 01 Nov 2005 20:23 GMT
* James Reynolds <james123@scl.utah.edu>
> I've been running the shell command in backticks, but if I can get a
> Perl way, I would be much happier.

Minus a module to do this on CPAN, you get to parse the binary
/var/run/[wu]tmp files for the information, whose format is
documented in:

man 5 utmp

I believe the Perl Cookbook includes an example program to parse the
said file...
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.