I am Looking for some help in creating a script to kill processes, but return an error message if they are owned by root. Firstly I would like to say that I am a total beginner at this. At the moment I currently have: kill `ps -aef | grep $1 | grep -v grep | awk '{print $2}'` Which works ok to kill a process name taken as an argument. but I cant get it work as an if statement, to stop it from killing a process if the the owner is root.