bash chmod 777 -R 在现有路径上获取 chmod: -R: 没有这样的文件或目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39043429/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
chmod 777 -R on existing path getting chmod: -R: No such file or directory
提问by RandomEli
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?
我想sudo chmod 777 -R <path>
在 mac 上授予操作访问权限,我仔细检查了给定的路径,它存在且没有拼写错误,但我仍然得到chmod: -R: No such file or directory
. 关于为什么我收到此错误的任何想法?
回答by Cyclonecode
If you look at the synopsis from the man page for chmod
you will se the following:
如果您查看手册页中的概要,chmod
您将看到以下内容:
SYNOPSIS
chmod [OPTION]... MODE[,MODE]... FILE...
chmod [OPTION]... OCTAL-MODE FILE...
chmod [OPTION]... --reference=RFILE FILE...
概要
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:
该-R
标志应在实际文件模式之前使用,因此您需要像这样调用命令:
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.
现在您正在尝试为777
一个名为的文件设置权限,该文件-R
当然不存在。