applyã¹ã²ã¨
id:otsuneããã«æãã¦è²°ã£ãapplyãç±ãã
BSDç³»ã®OSç¨ã½ãã®ã§ããµã¼ãä¸(Linuxç³»)ãã使ããªãã£ãã§ãã
Macã®OSXã ã¨ããã¾ããã
shã«æµãè¾¼ã¾ãã«è²ã
ã³ãã³ããå®è¡ã§ãããã§ããã
ls ã®çµæãxargsã§æ¸¡ãã¦ãããã¨applyã§ããããªãã¨ãã§ããï¼
ls | xargs apply "du -s" ã¨ããã¨
16 README 8 Rakefile 56 app 0 components 56 config 8 db 8 doc 0 lib 0 log 440 public 104 script 32 test 0 tmp 0 vendor
ã¨ãã§ããã£ã¬ã¯ããªã®ä¸è¦§ã¨ãã®åè¨å®¹éãåºãã¾ãããã
-dã渡ãã¦ãããã¨å®è¡å
容ãåºããããªã®ã§
ls | xargs apply -d "du -s"
ã§è¦ã¦ã¿ãã¨
exec du -s README exec du -s Rakefile exec du -s app exec du -s components exec du -s config exec du -s db exec du -s doc exec du -s lib exec du -s log exec du -s public exec du -s script exec du -s test exec du -s tmp exec du -s vendor
ã¨ãªã£ã¦ãã
ls | awk '{print "du -s "$1}' | sh
ã¨åããããªæå³ã§ããã
applyã®æ¹ãæ«å°¾ã«ã³ãã³ããããåãå±¥æ´ãæ¤ç´¢ãã¦æ«å°¾ããå¼ããã®ã§å¬ããã*1
*1:Mac OSXã®æ大ä¸æºç¹ã¯rm dirã¨ãã£ãå¾ãã£ã¬ã¯ããªã ãã¼ãã£ã¦æããã¦ä¸ãæ¼ãã¦å±¥æ´ã復活ããå¾ã" -fr"ã¨è¨è¿°ããã ãã§ããLinuxã¨éã£ã¦rm -fr dirã£ã¦ããªãããªããªãã®ãé¢åã¨æããèªåãrm dir -fr ãåãå ¥ãã¦ããã¦ãè¯ãã®ã«â¦â¦ã