1.txt, 2.txt, 3.txt, ...
ã®ããã«é£çªã®ãã¡ã¤ã«ããã£ãæã«ããã¡ã¤ã«åãç¹å®ã®æ¡ä»¶(ãã¨ãã°å¶æ°)ã«ãªã£ã¦ãããã®ã ããå¦çãããã¨ãããã¨ããã£ã¦ç°¡åã«èª¿ã¹ãã®ã§ã¡ã¢
å¶æ°å¥æ°ã®å ´åã«ã¯æ°å¤ã®æå¾ã®æåã ããè¦ãã°å¶æ°ãå¥æ°ãã¯å¤å®ã§ãã
ã©ãããã°ç°¡åãªã®ãããããããªãã£ããé©å½ã«æ¤ç´¢ã§èª¿ã¹ã¦ãããªæãã«ãã
ãã£ã¨ç°¡åã«ã§ããæ¹æ³ããã£ããã³ã¡ã³ããªã©ã§æãã¦ããã ããã¨å¬ããã§ã
findç
find
ã³ãã³ãã§ãã¡ã¤ã«åã«æ«å°¾ã®æåãæå®ãã¦å¼ã£ããã£ãã®ã ããå¦çãã
find . -name '*[13579].txt' -exec echo {} \;
forç
for
ã®in
ã®å¾ã«./*[02468].txt
ã¿ããã«æå®ãããããããããã¡ã¤ã«ããªã«ããªãã¨ãã«å±éãããã«æ®å¿µãªæãã«ãªã£ãã®ã§if
ã§ãã£ã«ã¿ããæãã«ãã¦ã¿ã
for file in ./*.txt; do if [[ $file == *[02468].txt ]]; then echo $file fi done
for file in ./*[02468].txt; do if [ -f $file ]; then echo $file fi done