I’m trying to write a simple bash script which should copy all files with complete permissions from some folders sent as parameters to a new folder.
This is what I have so far:
for dir in $@
do
find $dir -perm -exec cp{} newLocation \;
done
It says that -exec is not a known command here. What am I missing?
-perm requires a parameter that is permissions. What is happening here is that find is trying to interpret -exec as that permission.
You probably want something along the lines of