±ÈÈçÒªÔÚ/usr/samĿ¼Ï²éÕÒ²»ÔÚdir1×ÓĿ¼֮ÄÚµÄËùÓÐÎļþ
find /usr/sam -path "/usr/sam/dir1" -prune -o -print
find [-path ..] [expression] ÔÚ·¾¶ÁбíµÄºóÃæµÄÊDZí´ïʽ
-path "/usr/sam" -prune -o -print ÊÇ -path "/usr/sam" -a -prune -o
-print µÄ¼òд±í´ïʽ°´Ë³ÐòÇóÖµ, -a ºÍ -o ¶¼ÊǶÌ·ÇóÖµ£¬Óë shell µÄ && ºÍ || ÀàËÆÈç¹û -path "/usr/sam" ÎªÕæ£¬ÔòÇóÖµ -prune , -prune ·µ»ØÕ棬ÓëÂß¼±í´ïÊ½ÎªÕæ£»·ñÔò²»ÇóÖµ -prune£¬ÓëÂß¼±í´ïʽΪ¼Ù¡£Èç¹û -path "/usr/sam" -a -prune Ϊ¼Ù£¬ÔòÇóÖµ -print £¬-print·µ»ØÕ棬»òÂß¼±í´ïÊ½ÎªÕæ£»·ñÔò²»ÇóÖµ -print£¬»òÂß¼±í´ïÊ½ÎªÕæ¡£
Õâ¸ö±í´ïʽ×éºÏÌØÀý¿ÉÒÔÓÃαÂëдΪ
if -path "/usr/sam" then
-prune
else
-print
±Ü¿ª¶à¸öÎļþ¼Ð
find /usr/sam \( -path /usr/sam/dir1 -o -path /usr/sam/file1 \) -prune -o -print
Ô²À¨ºÅ±íʾ±í´ïʽµÄ½áºÏ¡£
\ ±íʾÒýÓ㬼´Ö¸Ê¾ shell ²»¶ÔºóÃæµÄ×Ö·û×÷ÌØÊâ½âÊÍ£¬¶øÁô¸ø find ÃüÁîÈ¥½âÊÍÆäÒâÒå¡£
²éÕÒijһȷ¶¨Îļþ£¬-nameµÈÑ¡Ïî¼ÓÔÚ-o Ö®ºó
#find /usr/sam \(-path /usr/sam/dir1 -o -path /usr/sam/file1 \) -prune -o -name "temp" -print
|
|
| |
|
¹Ø¼ü×Ö:
| ¹Ø¼ü×Ö: ʹÓÃfind²éÕÒÎļþµÄʱºòÔõô±Ü¿ªÄ³¸öÎļþĿ¼,²©Ö¾,soft,glen'blog,blog,weblog,blog,qzhiwu@msn.com |
|
ÒýÓÃ [0]
| ±¾ÎÄÎÞTrackback |
 |
|
Ìí¼ÓÆÀÂÛ
|