Chan Chen Coding...

          find -exec

          Find is able to execute one or more commands for each file it has found with the -exec option. Unfortunately, one cannot simply enter the command. You need to remember two syntactic tricks:

          1. The command that you want to execute need to contain a special macro argument {}, which will be replaced by the matched filename on each invocation of -exec predicate. 
          2. You need to specify \; (or ';' ) at the end of the command. (If the \ is left out, the shell will interpret the ; as the end of the find command.) . For example, the following two commands are equivalent:

            find . -name "*rc.conf"  -exec chmod o+r {} \;

            find . -name "*rc.conf" -exec chmod o+r '{} ;'



          -----------------------------------------------------
          Silence, the way to avoid many problems;
          Smile, the way to solve many problems;

          posted on 2012-03-19 13:59 Chan Chen 閱讀(661) 評(píng)論(0)  編輯  收藏 所屬分類: Linux

          主站蜘蛛池模板: 安阳县| 建瓯市| 全州县| 舟山市| 渑池县| 中宁县| 上虞市| 湖北省| 锦屏县| 镶黄旗| 内黄县| 廉江市| 琼海市| 兴业县| 孟村| 二连浩特市| 荥阳市| 东安县| 乐安县| 高碑店市| 达拉特旗| 榆林市| 临武县| 桐乡市| 买车| 武隆县| 全南县| 鄯善县| 海林市| 开阳县| 呼和浩特市| 石泉县| 文成县| 鹤峰县| 林周县| 龙里县| 太原市| 句容市| 罗源县| 云霄县| 金坛市|