I am trying to run through a directory and ensure that root it not the owner of any of the files. With awk, I am having an issue where comparing a field to a string does not yield an accurate result.
ls -d -l /path/to/file/**/* | awk '{ if ( "$3" == "root" ); print "File has wrong permissions: " $9;}'
What is generated is a list of files, and when double checked, whose owner and groups are not root.
-rw-rw-r-- 1 foobar foobar 78828 Dec 4 11:15 /p/t/f/xyz/abc.jpg
Ideally, the end result would be something like:
ls -d -l /path/to/file/**/* | awk '{ if ("$3" != "deploy" || "$4" != "deploy") [...]
What is wrong?
Thank you.
"$3" != "deploy"with$3 != "deploy"