Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?
ã§ããã°ã·ã§ã«ã¹ã¯ãªãããªãã¦æ¸ããããªããã ãã©ï¼ã¾ã ã¾ã æ¸ãæ©ä¼ã¯å¤ãï¼ã·ã§ã«è¸ãã¯ã³ã©ã¤ãã¼ã®ãããªåã£ããã¨ã§ã¯ãªãï¼ä»ã®ã²ã¨ã使ããããã·ã§ã«ã¹ã¯ãªãããæ¸ãããã«èªåãå®è·µãã¦ãããã¨ãã¾ã¨ãã¦ããï¼ ãã«ãã¡ãã»ã¼ã¸ æ¸ãã¦ãã·ã§ã«ã¹ã¯ãªããã使ãæ¨ã¦ã§ã¯ãªãä½åº¦ã使ããã®ã§ããå ´åã¯ï¼æ¬ä½ãæ¸ãå§ããåã«ï¼ãã®ã¹ã¯ãªããã®ä½¿ãæ¹ã表示ããusageé¢æ°ãæ¸ãã¦ãã¾ãï¼ ãããæ¸ãã¦ããã¨ï¼å¾ã ãã¼ã ã¸å ±æããããããªãï¼ã¨ããããusageè¦ã¦ãã ããã¨è¨ããï¼ã¾ãï¼ãããããæ¸ããã¨ã§ï¼åãªãã·ã§ã«ã¹ã¯ãªããã§ãã£ã¦ãèªåã®ä¸ã§åä½ãæ´çãã¦ããæ¸ãå§ãããã¨ãã§ããï¼é¢æ°ã¨ãã¦æ¸ãã®ã¯ï¼usageã表示ãã¦ãããã¨ããå ´é¢ãããã¤ãããï¼ä½¿ãåããã¨ãã§ããããï¼ ä»¥ä¸ã®ããã«æ¸ãï¼ function usage { cat <<EOF $(basename ${0})
ããã¾ã§ãå人çãªæè¦ã§ãã£ã¦ãèªåãã·ã§ã«ã¹ã¯ãªãããæ¸ãæã«æ°ãã¤ãã¦ããäºãåå¿é²çã«åæãã¦ããã ãã§ãã ãããããã¹ãã ãã¨æ¼ãã¤ãã¦ãã訳ã§ã¯ããã¾ããã å¿è«ãç§ã¯ãããã¦ãããã¨ããããããã¨è¯ãããã¨ããæè¦ãè°è«ã¯å¤§æè¿ã§ãã export (1) ããªãã·ã§ã«å¤æ°ã¯å ¨ã¦å°æåã§æ¸ãã PATH ã HOME ãªã©ã¯ç°å¢å¤æ°ãªã®ã§å¤§æåã§ã ã¹ã¯ãªããå ã§ä½¿ã£ã¦ããã®ã¯åãªãã·ã§ã«å¤æ°ãªã®ã§å°æåã§ã 使ãæ¹ãã¡ããã¨åºå¥ããäºã¯éè¦ã ã¨æãã ã·ã§ã«ã®å¤æ°å±éãæ´»ç¨ããã
ã¯ããã« ããããæ¸ãå 容ã¯ãã·ã§ã«ã¹ã¯ãªãããã°ãã°ãæ¸ãã¦ããç¾å ´(ãµã¼ãã¨ã³ã¸ãã¢ã»ã¤ã³ãã©ã¨ã³ã¸ãã¢)åãã®ãã®ã§ã¯ããã¾ããã å¹´ã«æ°åcrontabãããããããªç¾å ´(ãµã¼ãã«è©³ãããªãã¢ããªã±ã¼ã·ã§ã³ããã°ã©ããå¤æ°ãå ãããããªç¾å ´ã¨ããWebãã¶ã¤ããéããã°ã©ããcrontabãããããããããã£ãããããããªç¾å ´)ãæ³å®ãã¦ãã¾ãã >/dev/null 2>&1 ã®åé¡ç¹ ãã®è¨æ³ã®åé¡ç¹ã¯ããè¦ãã«ãããééãããããééã£ã¦ã¦ãæ°ã¥ããªããã¨ãããã¨ã§ãã åå¿è ãè¿·ãããè¦ç´ ããããªã«ããã¾ãã >/dev/nullã¯å ãå¾ã 1ã¨2ã¯ã©ã¡ããå ã &ã¯ã©ãã«æ¸ãã®ã ãã£ã¦ä¸è¨ã®ããã«å¤ç¨®å¤æ§ãªãã¹ãèµ·ããå¾ã¾ãã 2>&1 >/dev/null >/dev/null 1>&2 >/dev/null 2>1& >/dev/null &2>1 ãããã±ã£ã¨è¦ã¦
æåã¯ããæ¸ãã¦ããã lockfile build.lock ... rm -f build.lockã ãã©ãlockfileã¯å¤±æããæã«ããã©ã«ãã§ã¯ç¡éã«ãªãã©ã¤ããããã¡ãã£ã¨åºæ¥å¿ã§$ for i in {1..100}; do ./foo.sh; done;ãããã100人ã®å¾ ã¡è¡åãåºæ¥ã¦ãã¾ã£ãã ããããã£ããã¨ã¯ãæ¢ã«èµ·åãã¦ãããç¶è¡ããªãã§çµäºãã ã£ãã®ã§-r 0ã§ãªãã©ã¤åæ°ã0ã«ããã lockfile -r 0 build.lock || exit 1 ... rm -f build.lock
ãã°ããåãããã³ãã³ãã®çµäºã¹ãã¼ã¿ã¹ãããã³ããã®è²ã«åæ ãããããã«ãã¦ããã çµäºã¹ãã¼ã¿ã¹ã¨ã¯ Cè¨èªãªã int main(int argc, char* argv[]) { ... return 0; } ãã® return ãã¦ãã 0 ãçµäºã¹ãã¼ã¿ã¹ããã®æ´æ°å¤ã®ä¸ä½ 8bit ãããã»ã¹ã®çµäºæã«è¦ª (ãã®ããã»ã¹ãèµ·åããããã»ã¹) ã«ãããã çµäºã¹ãã¼ã¿ã¹ã®æå®æ¹æ³ã¯ãããããããCè¨èªã®å ´å main é¢æ°ã®æ»ãå¤ä»¥å¤ã«ã exit é¢æ°ã®å¼æ°ã§ãæå®ã§ãããRuby, Perl ã®å ´åããããã main é¢æ°ã¯ç¡ã㦠exit é¢æ°ã«å¼æ°ãä¸ããæ¹æ³ã ããã¤ãããã ãã®å¤ã¯ã·ã§ã«ä¸ã§ $? ã§åç §ã§ããã % perl -e 'exit(0xdead)'; echo $? 173 % æ £ä¾ã¨ãã¦ãæ£å¸¸çµäºã®ã¨ã㯠0 ãè¿ããã¨ã«ãªã£ã¦ããã % ls
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}