LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1069|回复: 1

请教参数传递

[复制链接]
发表于 2009-11-11 22:34:49 | 显示全部楼层 |阅读模式
在下参数传递还有不明。还请指教。谢谢俄


find ./ -inum 40 -print|rm<这里写什么呀。如何才能取find的返回值来当rm的参数>


find ./ -inum 12345 -print -exec rm {} -rf \;

还请高手回答。。这句的 是 rm后面为什么要更{} 还有 \
为什么不find ./ -inum 12345 -print -exec rm  -rf; 这样。
发表于 2009-11-18 10:50:45 | 显示全部楼层
see the find manual:

-exec command ;
              Execute  command;  true  if 0 status is returned.  All following
              arguments to find are taken to be arguments to the command until
              an  argument  consisting of `;' is encountered.  The string `{}'
              is replaced by the current file name being processed  everywhere
              it occurs in the arguments to the command, not just in arguments
              where it is alone, as in some versions of find.  Both  of  these
              constructions might need to be escaped (with a `\') or quoted to
              protect them from expansion by the shell.  See the EXAMPLES sec‐
              tion for examples of the use of the -exec option.  The specified
              command is run once for each matched file.  The command is  exe‐
              cuted  in  the starting directory.   There are unavoidable secu‐
              rity problems surrounding use of the -exec  action;  you  should
              use the -execdir option instead.
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表