Bat*_*ana 1 linux shell ubuntu ubuntu-12.04
我想弄清楚以下命令会做什么.我从Linux shell脚本中提取它,当我输入它时会进入提示符(>).但我无法弄清楚在这个提示中输入什么.
find ~/dev/tools/flex-4.5.0.20967 -type d -exec chmod o+rx '{}' \
Run Code Online (Sandbox Code Playgroud)
我在这里知道find命令的目的.它正在搜索指定的目录,检查它是否确实是一个目录并在该目录上执行chmod命令.我无法弄清楚的是chmod命令的格式.
我检查了chmod的man页面,但无法确定上述chmod格式的功能.
谢谢.
查看手册页find.在{} \;特定的-exec标志find
出现>提示,因为你错过了';' 在......的最后 '\;'
find ~/dev/tools/flex-4.5.0.20967 -type d -exec chmod o+rx '{}' \;
Run Code Online (Sandbox Code Playgroud)
该命令查找所有子目录~/dev/tools/flex-4.5.0.20967.没有-type d它也将包括该文件夹下的文件.
该-exec my_command my_args1 my_args2 '{}' \;部分通过find为每个匹配的结果指定,执行以下命令my_command:
my_command my_args1 my_args2 matched_result
Run Code Online (Sandbox Code Playgroud)
将{}被替换为匹配的结果,在这种情况下的目录,则\;是表明的论点终止了my_command