On Sat, Jun 07, 2036 at 04:42:08PM -0700, Tina Marie wrote:
>>> I need to have the number of users printed out within my perl script.
>> I know the UNIX command is w -h | wc -l
>> But how do I get it to print out like the sample below?
>>> There are 7 users logged on the system.
>
something like:
$num_users = `w -h | wc -l`;
print "There are $num_users logged on to the system.";
Although if there are users logged on multiple times it won't catch
that and you could get the line count in a perl-ier way...
David
--
David O'Callaghan
'I went past it on my way to CompUSA, or as I call it,
"CompUSA: Home Of The Total Morons Who Work At CompUSA."'
-- K.
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!