W
Werner Winter
Hello,
I've setup a linux terminal server. Now I want to know, which user is logged
in on which host . So I wrote a perl-script named "which_host"
# which user
$uid=$<;
$username=(getpwuid)$uid))[0];
$username = $1;
#which host
@last= `/usr/bin/last -n 1 -a $username`;
# line 18
$host= (split (/\s+/, $last[0]))[9];
The last two lines cause an error: Use of uninitialized value in string eq
at /usr/local/bin/which_host line 18
The problem is, that "last" shows only 8 columns, no host in column 9 is
shown. If I change the line
@last= `/usr/bin/last -n 1 -a $username`;
to
@last= `/usr/bin/last -n 3 -a $username`;
then I get 3 lines and in the third line the host is shown in column 9.
What can I do?
cu
Werner
I've setup a linux terminal server. Now I want to know, which user is logged
in on which host . So I wrote a perl-script named "which_host"
# which user
$uid=$<;
$username=(getpwuid)$uid))[0];
$username = $1;
#which host
@last= `/usr/bin/last -n 1 -a $username`;
# line 18
$host= (split (/\s+/, $last[0]))[9];
The last two lines cause an error: Use of uninitialized value in string eq
at /usr/local/bin/which_host line 18
The problem is, that "last" shows only 8 columns, no host in column 9 is
shown. If I change the line
@last= `/usr/bin/last -n 1 -a $username`;
to
@last= `/usr/bin/last -n 3 -a $username`;
then I get 3 lines and in the third line the host is shown in column 9.
What can I do?
cu
Werner