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 閱讀(660) 評論(0)  編輯  收藏 所屬分類: Linux

          主站蜘蛛池模板: 呼玛县| 林芝县| 昭平县| 容城县| 勐海县| 东光县| 商城县| 廉江市| 沙田区| 牙克石市| 庆云县| 彭州市| 定边县| 德格县| 平谷区| 新闻| 陇川县| 白朗县| 广安市| 宜都市| 孟津县| 盘山县| 黄大仙区| 洞口县| 二连浩特市| 门头沟区| 金川县| 昆山市| 若尔盖县| 北票市| 平江县| 永平县| 张家界市| 嘉义县| 湖口县| 成武县| 潮州市| 元阳县| 开阳县| 武定县| 高台县|