Hi Kevin, Kevin Mitchell wrote:
Looks good, except that that doesn't stop after finding the first user so that I get$ displaynum=0 $ user=`w -hs | awk '{ if ($3 == ":'$displaynum'" || $2 == ":'$displaynum'" ) print $1; }'` $ echo $user kevmitch kevmitch kevmitch kevmitch kevmitch kevmitch kevmitch The following seems to return a unique value however: $ user=`w -hs | awk '{ if ($3 == ":'$displaynum'" || $2 == ":'$displaynum'" ) {print $1;nextfile}; }'` $ echo $user kevmitch Not sure if that's necessarily the "correct" way to do it but it seems to work in my case.
Seems fine to me. Alternatively I could pipe it through head -n 1. But I'm actually interested why you have multiple lines that match ":0" in your "w -hs" output. What does w -hs show for you?
PS: When does displaynum appear in the tty column?
It turns out that with xdm, the displaynum appears in the TTY column, while with gdm, it appears in the From column. Apparently xdm does the right thing, but gdm doesn't register its session in wtmp. Or at least, that was suggested by the reporters of the original bug which caused me to change this code...
Cheers, Bart -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

