I want to do a find for files and ignore permission denied.
My basic command is:
find . -type f -name “*ext”
I can get rid of the error message by adding:
find . -type f -name “*ext” 2>/dev/null
But, the Exit Status is 1, and not 0, which complicates automation.
If I plug this into a script in a for loop, I make it a habit to check the exit status before proceeding. I’ve played around with various find options, but have not been successful in getting find to ignore permission denied. I want the command to be pretty generic. I did try putting in a user and group which shouldn’t have matched, played with ands and or’s and complex stmts, but find still returned with an exit status of 1. I don’t want to use sudo.