问题
I wanted to grant operation access using sudo chmod 777 -R <path>
on mac, I double checked the given path, and it's existing and no typos, but I still got chmod: -R: No such file or directory
. Any ideas about why I'm getting this error?
回答1:
If you look at the synopsis from the man page for chmod
you will se the following:
SYNOPSIS
chmod [OPTION]... MODE[,MODE]... FILE...
chmod [OPTION]... OCTAL-MODE FILE...
chmod [OPTION]... --reference=RFILE FILE...
The -R
flag should be used before the actual file mode, so you need to call the command like this:
sudo chmod -R 777 <path>
Right now you are trying to set 777
permission on a file named -R
which of course does not exist.
来源:https://stackoverflow.com/questions/39043429/chmod-777-r-on-existing-path-getting-chmod-r-no-such-file-or-directory