I want to find all files the are not owned by me (that is, having no permission to modify it). I have tried
find . -exec if [[ ! -O {} ]]; then echo {}; fi ;
But if I put the whole command after -exec in quotes, like this:
find . -exec 'if [[ ! -O {} ]]; then echo {}; fi' \;
Neither that work, because the reference to the current file {} is in quotes and therefor does not expand to the file.
The problem is, I do not know how to embed the {} as current file to more complex -exec then simply for example find . -exec grep smf {} \; (that uses the {} only once). How to use -exec option in find in commands, where you reference to the current file more then once ? (That is using {} more time).
{}? – Herdsman Apr 13 '20 at 12:30bashjust before{}is a string that is placed in$0. It is only used by thebash -cscript if it needs to print any error messages. – Kusalananda Apr 13 '20 at 12:33