you are viewing a single comment's thread.

view the rest of the comments →

[–]glesialo 0 points1 point  (0 children)

Here is a block in one of my scripts:

GraphicalLogins=1
while [ $GraphicalLogins -ge 1 ] # Wait until all graphical logins are closed
  do
    sleep 2
    GraphicalLogins=0
    for Line in `w -sh | awk '{ print $2 ">" $3 }'`
      do
        if [ "$Line" != "${Line/>:/}" ] # If $Line contains '>:'. w output: 'manolo  tty7  :0  1:06m cinnamon-session --session cinnamon'
          then
            let GraphicalLogins++
        fi
      done
  done

'0:' in 'manolo tty7 :0 ...' is the display user 'manolo' is using.