æ»èµã³ãã³ã
ã¹ã©ãã·ã¥ãããã«ã死蔵しているコマンド、どのくらいありますか?ããªãã¦è¨äºãè¼ã£ã¦ããPlan9ãªãã
cpu% ls /bin | wc 339 339 3673
ã§ã»ã¼æ£ç¢ºãªã³ãã³ãæ°ãããã*1ã339åãæè¿ã¯çµè¾¼ã¿ç¨ã®BusyBoxã§ãã200åè¿ãã®ã³ãã³ãããµãã¼ãããããã«ãªã£ã¦ãããããããã¶ãå°ãªããã¨ããããã
ããã§ããã®ã¯ãç°å¢å¤æ°$pathã¯ã«ã¬ã³ããã£ã¬ã¯ããªã¨/binã ãã ããã
cpu% echo $path . /bin
ãã®æ¥è¨ã§ã¯ä½åº¦ãæ¸ãã¦ãããã©ã/binã¯ユニオンディレクトリã«ãªã£ã¦ããã
cpu% ns |grep /bin bind /386/bin /bin bind -a /rc/bin /bin bind -a /usr/oraccha/bin/rc /bin bind -a /usr/oraccha/bin/386 /bin
ä¸æ¹ãUNIXerã§ããã°ãã«ã¬ã³ããã£ã¬ã¯ããªã$pathã«å ¥ããã®ã¯æ°æã¡æªããã¨ç´æçã«æããã ãããUNIX FAQã«ã¯ã次ã®ããã«æ¸ããã¦ããã
2.13) $PATH に '.' を入れると、どんな不都合が起こるのですか。
ï¼ç¥ï¼
PATH ã®ã©ããã« "." ãå ¥ããã¨ä¾¿å©ã§ããã«ã¬ã³ããã£ã¬ã¯ããªã®ããã°ã© ã ãå®è¡ããæã"./a.out" ã®ä»£ããã« "a.out" ã¨å ¥åãããã¨ãã§ãã¾ãã ãããããã«ã¯è½ãç©´ãããã¾ãã
"." ã PATH ã®æåã«ããå ´åã«ä½ãèµ·ãããèãã¾ããã«ã¬ã³ããã£ã¬ã¯ã ãªã¯ "/tmp" ã®ããã«ã ãã§ãæ¸ãè¾¼ããã¨ãã¾ããããããããã¾ãã¾èª°ã éãã¦ã¼ã¶ã¼ãæ®ãã "/tmp/ls" ã¨è¨ãååã®ããã°ã©ã ããã£ãã¨ãã¾ãã ããã¦ãã®æ (ãã¡ããæ®éã® "/bin/ls" ããã°ã©ã ãèµ°ãããã¤ããã§) "ls" ã¨å ¥åãã㨠ãã·ã§ã«ã¯ä»ã®ã¦ã¼ã¶ã¼ãä½ã£ãããã°ã©ã ã® "./ls" ã 代ããã«èµ°ãããã§ããããããã¨è¨ãã¾ã§ããªãããã®ãããªè¦ç¥ãã¬ãã ã°ã©ã ãå®è¡ãã¦ãã¾ãé©ããã¨ã§ãããã
ï¼ç¥ï¼
/tmp/lsã®å®è¡ã«ãã£ã¦ãããã¤ã®æ¨é¦¬ãä»æãããã¦ãã¾ããããããªãã
Plan9ã®å ´åãåå空éãããã»ã¹ãã¨ã«ç°ãªãã®ã§ããã®ãããªè½ã¨ãç©´ã¯åå¨ããªãï¼ãã¡ããå¢ç©´ãæãã®ã¯èªç±ã ãï¼ãã¡ãªã¿ã«/tmpãã¦ã¼ã¶ãã¨ã«ç°ãªã£ã¦ãã¦ããã°ã¤ã³æã«/usr/oraccha/tmpãbindããããã«ãªã£ã¦ããã
*1:æ»èµãã©ãã調ã¹ãã«ã¯ãã³ãã³ãå±¥æ´ãæ¤ç´¢ããã®ããªï¼