While using fish as my shell, i'm trying to set permissions on a bunch of c source files in current dir with
find . -type f -name "*.c" -exec chmod 644 {} +;
I get an error
find: missing argument to `-exec'
or
find . -type f -name "*.c" -exec chmod 644 {} \;
I get an error
chmod: cannot access '': No such file or directory
What's wrong?
Best Answer
fish
happens to be one of the few shells where that{}
needs to be quoted.So, with that shell, you need:
When not quoted,
{}
expands to an empty argument, so the command becomes the same as:And
find
complains about the missing{}
(or;
as+
is only recognised as the-exec
terminator when following{}
).With most other shells, you don't need the quotes around
{}
.