[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to detect which user is connected to $DISPLAY

sean finney wrote:

i invite someone to invent a better way, i'd like to hear it :)

Rather than invoke awk twice, just use awk for everything (-:
(I used $DISPLAY for testing)

w | awk "\$3 ~ /$DISPLAY/ {print \$1; exit 0}"

Note the escaped '$'s.

Reply to: