Okay, so i have strange problem with the following piece of code:
who > tmp
cat tmp | awk '{print $1}' | sort | uniq > tmp
ps aux | grep -Fvf tmp
It is supposed to list processes of all users not logged in at the moment. Problem is it sometimes works, and sometimes doesn't and I have no idea what causes it. I can enter exactly same commands and I get 2 different results. I've narrowed the problem to 2nd line > tmp redirect, where it saves proper user list or wipes the file completely and I have no idea why it happens.
PS. I know it may not be proper solution for the task, but it's what I came up with during limited time I was given.