in reply to reference question
- Miller#!/usr/bin/perl -w use strict; my %ttys_of; foreach (`who`) { my ($user, $tty) = /(\S+)\s+(\S+)/; push @{$ttys_of{$user}}, $tty; } foreach my $user (sort keys %ttys_of) { my $ttys = $ttys_of{$user}; if (@$ttys == 1) { print "user $user is ONLY logged in at one place $ttys->[0]\n" +; } else { print "user $user is logged in at: " . join(' ', sort @$ttys) +. "\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: reference question
by convenientstore (Pilgrim) on Jul 29, 2007 at 03:15 UTC | |
by wind (Priest) on Jul 29, 2007 at 04:20 UTC | |
|
Re^2: reference question
by convenientstore (Pilgrim) on Jul 29, 2007 at 01:35 UTC |