{"id":3017,"date":"2025-10-20T18:27:07","date_gmt":"2025-10-20T09:27:07","guid":{"rendered":"https:\/\/blog.id774.net\/entry\/?p=3017"},"modified":"2025-10-20T21:27:30","modified_gmt":"2025-10-20T12:27:30","slug":"%e3%83%97%e3%83%ad%e3%82%bb%e3%82%b9%e5%a2%83%e7%95%8c%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e8%80%83%e3%81%88%e3%82%8b","status":"publish","type":"post","link":"https:\/\/blog.id774.net\/entry\/2025\/10\/20\/3017\/","title":{"rendered":"\u30d7\u30ed\u30bb\u30b9\u5883\u754c\u306b\u3064\u3044\u3066\u8003\u3048\u308b"},"content":{"rendered":"<p>\u524d\u56de\u306f\u3001<a href=\"https:\/\/blog.id774.net\/entry\/2025\/10\/19\/3016\/\">\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u672b\u5c3e\u306b exit $? \u3092\u660e\u793a\u3059\u308b<\/a>\u662f\u975e\u306b\u3064\u3044\u3066\u6574\u7406\u3057\u305f\u3002\u672c\u7a3f\u3067\u306f\u3001\u305d\u306e\u8b70\u8ad6\u306e\u80cc\u5f8c\u306b\u3042\u308b\u4e2d\u6838\u6982\u5ff5\u3067\u3042\u308b\u30d7\u30ed\u30bb\u30b9\u5883\u754c\u3092\u307e\u3068\u3081\u308b\u3002\u5b50\u30b9\u30af\u30ea\u30d7\u30c8\u304c exit \u3057\u3066\u3082\u547c\u3073\u51fa\u3057\u5143\u304c\u7d42\u4e86\u3057\u306a\u3044\u7406\u7531\u3001\u305d\u3057\u3066\u7d42\u4e86\u3055\u305b\u305f\u3044\u5834\u5408\u306e\u8a2d\u8a08\u4e0a\u306e\u9078\u629e\u80a2\u3092\u3001\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u3068 Python \u306e\u53cc\u65b9\u304b\u3089\u78ba\u8a8d\u3059\u308b\u3002<\/p>\n<hr>\n<h2>\u30d7\u30ed\u30bb\u30b9\u5883\u754c\u3068\u306f\u4f55\u304b<\/h2>\n<p>\u30d7\u30ed\u30bb\u30b9\u5883\u754c\u3068\u306f\u3001\u89aa\u30d7\u30ed\u30bb\u30b9\u3068\u5b50\u30d7\u30ed\u30bb\u30b9\u3092\u9694\u3066\u308b\u58c1\u306e\u3053\u3068\u3067\u3042\u308b\u3002\u5404\u30d7\u30ed\u30bb\u30b9\u306f OS \u306b\u3088\u308a\u72ec\u7acb\u3057\u305f\u30a2\u30c9\u30ec\u30b9\u7a7a\u9593\u30fb\u74b0\u5883\u30fb\u30d5\u30a1\u30a4\u30eb\u30c7\u30a3\u30b9\u30af\u30ea\u30d7\u30bf\u30fbPID \u3092\u6301\u3061\u3001\u4ed6\u30d7\u30ed\u30bb\u30b9\u306e\u30e1\u30e2\u30ea\u3084\u5236\u5fa1\u30d5\u30ed\u30fc\u306b\u76f4\u63a5\u5e72\u6e09\u3057\u306a\u3044\u3002\u3057\u305f\u304c\u3063\u3066\u3001\u5b50\u30d7\u30ed\u30bb\u30b9\u304c exit \u3057\u3066\u3082\u89aa\u30d7\u30ed\u30bb\u30b9\u306f\u7d42\u4e86\u3057\u306a\u3044\u3002\u89aa\u306b\u4f1d\u308f\u308b\u306e\u306f\u7d42\u4e86\u30b3\u30fc\u30c9\u3068\u3044\u3046\u6574\u6570\u5024\u306e\u307f\u3067\u3042\u308b\u3002<\/p>\n<hr>\n<h2>\u30d7\u30ed\u30bb\u30b9\u5883\u754c\u304c\u610f\u5473\u3059\u308b\u3053\u3068<\/h2>\n<ul>\n<li>\u30e1\u30e2\u30ea\u7a7a\u9593\u306f\u72ec\u7acb\u3057\u3066\u304a\u308a\u3001\u5909\u6570\u3084\u95a2\u6570\u306e\u72b6\u614b\u3092\u5171\u6709\u3057\u306a\u3044\u3002<\/li>\n<li>exit \u306f\u81ea\u5206\uff08\uff1d\u73fe\u5728\u306e\u30d7\u30ed\u30bb\u30b9\uff09\u3060\u3051\u3092\u7d42\u4e86\u3055\u305b\u308b\u3002<\/li>\n<li>\u89aa\u30d7\u30ed\u30bb\u30b9\u306b\u306f\u7d42\u4e86\u30b3\u30fc\u30c9\uff08$? \u3084 return code\uff09\u3060\u3051\u304c\u8fd4\u308b\u3002<\/li>\n<li>\u30c7\u30fc\u30bf\u53d7\u3051\u6e21\u3057\u306f\u30d1\u30a4\u30d7\u30fb\u30d5\u30a1\u30a4\u30eb\u30fb\u30bd\u30b1\u30c3\u30c8\u306a\u3069\u306e\u660e\u793a\u7684\u30c1\u30e3\u30cd\u30eb\u3092\u901a\u3059\u3002<\/li>\n<li>\u89aa\u5b50\u9593\u306e\u5236\u5fa1\u9023\u643a\u306b\u306f\u3001\u7d42\u4e86\u30b3\u30fc\u30c9\u8a55\u4fa1\u3001\u30b7\u30b0\u30ca\u30eb\u3001\u30d1\u30a4\u30d7\u3001\u5f85\u6a5f\u306e\u3044\u305a\u308c\u304b\u304c\u5fc5\u8981\u3067\u3042\u308b\u3002<\/li>\n<\/ul>\n<hr>\n<h2>Unix \/ Linux \u306b\u304a\u3051\u308b\u30d7\u30ed\u30bb\u30b9\u5883\u754c<\/h2>\n<p>Unix \u7cfb OS \u3067\u306f\u3001\u30d7\u30ed\u30bb\u30b9\u751f\u6210\u304c\u660e\u78ba\u306a\u4e8c\u6bb5\u968e\u69cb\u9020\u3067\u3042\u308b fork() \u3068 exec() \u306b\u3088\u3063\u3066\u884c\u308f\u308c\u308b\u3002fork() \u306f\u89aa\u306e\u30b3\u30d4\u30fc\u3068\u3057\u3066\u5b50\u3092\u4f5c\u308a\u3001exec() \u306f\u305d\u306e\u5b50\u306b\u5225\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4e0a\u66f8\u304d\u5b9f\u884c\u3055\u305b\u308b\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u89aa\u3068\u5b50\u306f\u5b8c\u5168\u306b\u72ec\u7acb\u3057\u305f\u5b9f\u884c\u5358\u4f4d\u3068\u306a\u308b\u3002<\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:1000px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">get-device \/mnt\/disk1<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>\u4e0a\u306e\u3088\u3046\u306a\u901a\u5e38\u306e\u5916\u90e8\u30b3\u30de\u30f3\u30c9\u547c\u3073\u51fa\u3057\u306f\u3001\u5b50\u30d7\u30ed\u30bb\u30b9\u3092\u751f\u6210\u3057\u3066\u5b9f\u884c\u3057\u3001\u7d42\u4e86\u30b3\u30fc\u30c9\u306e\u307f\u3092\u89aa\u306b\u8fd4\u3059\u3002\u89aa\u30b7\u30a7\u30eb\u306f\u751f\u304d\u305f\u307e\u307e\u3067\u3042\u308a\u3001\u5fc5\u8981\u3067\u3042\u308c\u3070 $? \u3092\u8a55\u4fa1\u3057\u3066\u81ea\u3089\u306e\u632f\u308b\u821e\u3044\uff08\u7d99\u7d9a\u304b\u7d42\u4e86\u304b\uff09\u3092\u6c7a\u3081\u308b\u3002<\/p>\n<hr>\n<h2>\u540c\u4e00\u30d7\u30ed\u30bb\u30b9\u3068\u3057\u3066\u5b9f\u884c\u3057\u305f\u3044\u5834\u5408<\/h2>\n<p>\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u540c\u4e00\u30d7\u30ed\u30bb\u30b9\u3067\u5b9f\u884c\u3059\u308b\u3068\u3001exit \u304c\u89aa\u306b\u3082\u6ce2\u53ca\u3059\u308b\u3002\u3053\u308c\u306f\u4f8b\u5916\u7684\u306b\u5883\u754c\u3092\u4f5c\u3089\u306a\u3044\u5b9f\u884c\u5f62\u614b\u3067\u3042\u308b\u3002<\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:1000px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">. .\/get-device<br \/>\n# \u307e\u305f\u306f<br \/>\nsource .\/get-device<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>\u540c\u69d8\u306b\u3001exec \u306f\u73fe\u5728\u306e\u30d7\u30ed\u30bb\u30b9\u3092\u7f6e\u304d\u63db\u3048\u308b\u306e\u3067\u3001\u5b9f\u884c\u5f8c\u306e exit \u3067\u89aa\u306f\u7d42\u4e86\u3059\u308b\u3002<\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:1000px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">exec \/etc\/cron.exec\/rsync_backup.sh<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>\u3053\u306e\u4e8c\u3064\u306f\u5f37\u529b\u3060\u304c\u3001\u89aa\u3092\u5dfb\u304d\u8fbc\u3093\u3067\u7d42\u4e86\u3059\u308b\u305f\u3081\u904b\u7528\u4e0a\u306e\u30ea\u30b9\u30af\u304c\u9ad8\u3044\u3002\u901a\u5e38\u306f\u907f\u3051\u308b\u3002<\/p>\n<hr>\n<h2>\u547c\u3073\u51fa\u3057\u5143\u304c\u5f71\u97ff\u3092\u53d7\u3051\u306a\u3044\u5b9f\u4f8b<\/h2>\n<h3>1) \u30b7\u30a7\u30eb\u304b\u3089\u5b50\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c<\/h3>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:1000px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">test -x \/etc\/cron.exec\/rsync_backup.sh &amp;&amp; \/etc\/cron.exec\/rsync_backup.sh &gt;&gt; &quot;$JOBLOG&quot; 2&gt;&amp;1<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>\u3053\u308c\u306f<a href=\"https:\/\/blog.id774.net\/entry\/2025\/09\/01\/2977\/\">\u5225\u30d7\u30ed\u30bb\u30b9\u5b9f\u884c<\/a>\u3067\u3042\u308b\u3002<a href=\"https:\/\/github.com\/id774\/scripts\/blob\/master\/cron\/bin\/rsync_backup.sh\">rsync_backup.sh<\/a> \u5185\u3067 exit\uff08\u306a\u3044\u3057 exit $?\uff09\u3057\u3066\u3082\u3001\u547c\u3073\u51fa\u3057\u5143\u306e\u30b7\u30a7\u30eb\u306f\u7d42\u4e86\u3057\u306a\u3044\u3002\u7d42\u4e86\u3055\u305b\u305f\u3044\u306a\u3089\u547c\u3073\u51fa\u3057\u5143\u3067\u7d42\u4e86\u30b3\u30fc\u30c9\u3092\u5224\u5b9a\u3057\u3066\u660e\u793a\u7684\u306b exit \u3059\u308b\u3002<\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:1000px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">\/etc\/cron.exec\/rsync_backup.sh &gt;&gt; &quot;$JOBLOG&quot; 2&gt;&amp;1<br \/>\nrc=$?<br \/>\n[ &quot;$rc&quot; -ne 0 ] &amp;&amp; exit &quot;$rc&quot;<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<h3>2) \u30b3\u30de\u30f3\u30c9\u7f6e\u63db\u5185\u306e\u30b9\u30af\u30ea\u30d7\u30c8<\/h3>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:1000px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">dev=$(get-device &quot;$T_HOME\/$T_MOUNT\/$T_DEVICE&quot;)<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>$(\u2026) \u306e\u4e2d\u8eab\u3082\u30b5\u30d6\u30d7\u30ed\u30bb\u30b9\uff08\u5b50\uff09\u3067\u8d70\u308b\u3002<a href=\"https:\/\/github.com\/id774\/scripts\/blob\/master\/get-device.sh\">get-device<\/a> \u304c exit 1 \u3057\u3066\u3082\u3001\u89aa\u306f\u751f\u304d\u7d9a\u3051\u3001$? \u3084\u5c55\u958b\u7d50\u679c\u306e\u6709\u7121\u3067\u5206\u5c90\u3067\u304d\u308b\u3002<\/p>\n<h3>3) Python \u304b\u3089\u5916\u90e8\u30b3\u30de\u30f3\u30c9\u547c\u3073\u51fa\u3057\uff08\u73fe\u4ee3\u7684\u624b\u6cd5\uff09<\/h3>\n<p>Python 3.5 \u4ee5\u964d\u3067\u306f\u3001subprocess.run() \u304c\u6a19\u6e96\u7684\u306a\u65b9\u6cd5\u3067\u3042\u308b\u3002\u5b50\u30d7\u30ed\u30bb\u30b9\u306e exit \u306f\u89aa\u306e Python \u3092\u7d42\u4e86\u3055\u305b\u306a\u3044\u3002\u623b\u308a\u5024\u306e return code \u3092\u898b\u3066\u5236\u5fa1\u3092\u5224\u65ad\u3059\u308b\u3002<\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:1000px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">import subprocess<br \/>\n<br \/>\nresult = subprocess.run([&quot;ls&quot;, &quot;-l&quot;], capture_output=True, text=True)<br \/>\nprint(result.stdout)<br \/>\n<br \/>\nif result.returncode != 0:<br \/>\n&nbsp; &nbsp; print(&quot;Error occurred&quot;)<br \/>\n&nbsp; &nbsp; exit(result.returncode)<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>subprocess.run() \u306f CompletedProcess \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u8fd4\u3057\u3001stdout\u30fbstderr\u30fbreturn code \u3092\u4e00\u62ec\u3067\u6271\u3048\u308b\u3002check=True \u3092\u6307\u5b9a\u3059\u308c\u3070\u3001\u975e\u30bc\u30ed\u7d42\u4e86\u30b3\u30fc\u30c9\u3067\u4f8b\u5916\uff08CalledProcessError\uff09\u304c\u9001\u51fa\u3055\u308c\u308b\u3002<\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:1000px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">subprocess.run([&quot;false&quot;], check=True)<br \/>\n# \u2192 CalledProcessError \u304c\u767a\u751f<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>\u307e\u305f\u3001\u30b3\u30de\u30f3\u30c9\u306e\u5b58\u5728\u78ba\u8a8d\u306b\u306f shutil.which() \u3092\u5229\u7528\u3059\u308b\u3002<\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:1000px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">import shutil<br \/>\nif shutil.which(&quot;rsync&quot;):<br \/>\n&nbsp; &nbsp; subprocess.run([&quot;rsync&quot;, &quot;--version&quot;])<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>\u53e4\u3044\u30b3\u30fc\u30c9\u3067\u898b\u3089\u308c\u308b subprocess.call() \u3084 os.system() \u306f\u975e\u63a8\u5968\u3067\u3042\u308a\u3001\u6a19\u6e96\u51fa\u529b\u306e\u6271\u3044\u3084\u30a8\u30e9\u30fc\u691c\u51fa\u304c\u4e0d\u5341\u5206\u3067\u3042\u308b\u3002\u73fe\u4ee3\u306e Python \u30b3\u30fc\u30c9\u3067\u306f subprocess.run() \u3092\u57fa\u8ef8\u306b\u8a2d\u8a08\u3059\u3079\u304d\u3067\u3042\u308b\u3002<\/p>\n<table>\n<tr>\n<th>\u6642\u4ee3<\/th>\n<th>\u4e3b\u306aAPI<\/th>\n<th>\u51fa\u529b\u53d6\u5f97<\/th>\n<th>\u4f8b\u5916\u5236\u5fa1<\/th>\n<th>\u73fe\u884c\u63a8\u5968<\/th>\n<\/tr>\n<tr>\n<td>\u301cPython 2\u7cfb\u521d\u671f<\/td>\n<td>os.system<\/td>\n<td>\u2717<\/td>\n<td>\u2717<\/td>\n<td>\u2717<\/td>\n<\/tr>\n<tr>\n<td>Python 2\u7cfb<\/td>\n<td>os.popen \/ commands<\/td>\n<td>\u25cb<\/td>\n<td>\u2717<\/td>\n<td>\u2717<\/td>\n<\/tr>\n<tr>\n<td>Python 2.4\u301c3.4<\/td>\n<td>subprocess.call \/ Popen<\/td>\n<td>\u25cb<\/td>\n<td>\u25b3<\/td>\n<td>\u25b3<\/td>\n<\/tr>\n<tr>\n<td>Python 3.5\u301c<\/td>\n<td>subprocess.run<\/td>\n<td>\u25cb<\/td>\n<td>\u25ce<\/td>\n<td>\u25ce<\/td>\n<\/tr>\n<\/table>\n<hr>\n<h2>\u4ed6\u306e OS \u306b\u304a\u3051\u308b\u30d7\u30ed\u30bb\u30b9\u5883\u754c<\/h2>\n<p>\u30d7\u30ed\u30bb\u30b9\u3068\u3044\u3046\u6982\u5ff5\u306f Linux \/ Unix \u306b\u9650\u3089\u308c\u305f\u3082\u306e\u3067\u306f\u306a\u3044\u3002Windows \u3067\u3082 CreateProcess() \u3068 ExitProcess() \u306b\u3088\u308a\u72ec\u7acb\u6027\u304c\u63d0\u4f9b\u3055\u308c\u3001\u5b50\u306e\u7d42\u4e86\u306f\u89aa\u306e\u7d42\u4e86\u3092\u610f\u5473\u3057\u306a\u3044\u3002\u73fe\u4ee3\u306e\u307b\u307c\u3059\u3079\u3066\u306e OS \u304c\u30d7\u30ed\u30bb\u30b9\u3054\u3068\u306b\u72ec\u7acb\u3057\u305f\u5b9f\u884c\u7a7a\u9593\u3092\u6301\u3064\u3068\u3044\u3046\u8a2d\u8a08\u3092\u63a1\u7528\u3057\u3066\u3044\u308b\u3002<\/p>\n<hr>\n<h2>\u30d7\u30ed\u30bb\u30b9\u5883\u754c\u306e\u672c\u8cea<\/h2>\n<p>\u30d7\u30ed\u30bb\u30b9\u5883\u754c\u3068\u306f\u3001\u8a00\u3044\u63db\u3048\u308c\u3070\u300cexit \u306e\u6ce2\u53ca\u3092\u6b62\u3081\u308b\u58c1\u300d\u3067\u3042\u308a\u3001\u300c$? \u3060\u3051\u304c\u8d8a\u3048\u3066\u304f\u308b\u7a93\u53e3\u300d\u3067\u3042\u308b\u3002\u5b50\u304c\u3069\u306e\u3088\u3046\u306b\u7d42\u4e86\u3057\u3066\u3082\u3001\u305d\u306e\u7d42\u4e86\u30b3\u30fc\u30c9\u3092\u53d7\u3051\u53d6\u3063\u3066\u5224\u65ad\u3059\u308b\u306e\u306f\u89aa\u306e\u5f79\u5272\u3067\u3042\u308b\u3002\u3053\u306e\u8a2d\u8a08\u3053\u305d\u304c\u3001\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u3084 Python \u304c\u5805\u7262\u306b\u52d5\u4f5c\u3057\u7d9a\u3051\u308b\u57fa\u76e4\u3068\u306a\u3063\u3066\u3044\u308b\u3002<\/p>\n<hr>\n<h2>\u8a2d\u8a08\u30c1\u30a7\u30c3\u30af\u30ea\u30b9\u30c8<\/h2>\n<ul>\n<li>\u5b50\u306e\u5931\u6557\u3067\u89aa\u3092\u7d42\u4e86\u3055\u305b\u305f\u3044\u304b\u3002\u2192 \u89aa\u304c\u7d42\u4e86\u30b3\u30fc\u30c9\u3092\u8a55\u4fa1\u3057 exit\uff08\u307e\u305f\u306f source\/exec \u3092\u660e\u793a\u63a1\u7528\uff09\u3002<\/li>\n<li>\u5b50\u306e\u5931\u6557\u3092\u96c6\u8a08\u3057\u3066\u6700\u5f8c\u306b\u5224\u65ad\u3057\u305f\u3044\u304b\u3002\u2192 \u623b\u308a\u5024\u3092\u84c4\u7a4d\u3057\u3001\u6700\u5f8c\u306b\u4ee3\u8868\u5024\u3067 exit\u3002<\/li>\n<li>\u30ed\u30b0\u3068\u53ef\u89b3\u6e2c\u6027\u306f\u5341\u5206\u304b\u3002\u2192 \u76f4\u5f8c\u306b RC=$? \u3092\u4fdd\u5b58\u3057\u30ed\u30b0\u3078\u51fa\u529b\u3002<\/li>\n<li>\u30b5\u30d6\u30b7\u30a7\u30eb\u3084\u30b3\u30de\u30f3\u30c9\u7f6e\u63db\u306e\u5931\u6557\u304c\u63e1\u308a\u6f70\u3055\u308c\u3066\u3044\u306a\u3044\u304b\u3002\u2192 \u5c55\u958b\u7d50\u679c\u3068 $? \u3092\u5fc5\u305a\u691c\u67fb\u3002<\/li>\n<\/ul>\n<hr>\n<h2>\u307e\u3068\u3081<\/h2>\n<ul>\n<li>\u30d7\u30ed\u30bb\u30b9\u5883\u754c\u306f exit \u306e\u6ce2\u53ca\u3092\u6b62\u3081\u308b\u58c1\u3067\u3042\u308b\u3002<\/li>\n<li>\u5b50\u304c exit \u3057\u3066\u3082\u89aa\u306f\u7d42\u4e86\u3057\u306a\u3044\u3002\u89aa\u306b\u4f1d\u308f\u308b\u306e\u306f\u7d42\u4e86\u30b3\u30fc\u30c9\u306e\u307f\u3067\u3042\u308b\u3002<\/li>\n<li>Python \u3067\u306f subprocess.run() \u304c\u73fe\u884c\u6a19\u6e96\u3067\u3042\u308a\u3001return code \u3092\u8a55\u4fa1\u3057\u3066\u5236\u5fa1\u3092\u6c7a\u3081\u308b\u3002<\/li>\n<li>\u3053\u306e\u6027\u8cea\u306f Linux \/ Unix \u306b\u9650\u3089\u305a\u4e3b\u8981 OS \u306b\u5171\u901a\u3067\u3042\u308b\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u306f\u3001\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u672b\u5c3e\u306b exit $? \u3092\u660e\u793a\u3059\u308b\u662f\u975e\u306b\u3064\u3044\u3066\u6574\u7406\u3057\u305f\u3002\u672c\u7a3f\u3067\u306f\u3001\u305d\u306e\u8b70\u8ad6\u306e\u80cc\u5f8c\u306b\u3042\u308b\u4e2d\u6838\u6982\u5ff5\u3067\u3042\u308b\u30d7\u30ed\u30bb\u30b9\u5883\u754c\u3092\u307e\u3068\u3081\u308b\u3002\u5b50\u30b9\u30af\u30ea\u30d7\u30c8\u304c exit \u3057\u3066\u3082\u547c\u3073\u51fa\u3057\u5143\u304c\u7d42\u4e86\u3057\u306a\u3044\u7406\u7531\u3001\u305d\u3057\u3066\u7d42\u4e86 &#8230; <a title=\"\u30d7\u30ed\u30bb\u30b9\u5883\u754c\u306b\u3064\u3044\u3066\u8003\u3048\u308b\" class=\"read-more\" href=\"https:\/\/blog.id774.net\/entry\/2025\/10\/20\/3017\/\" aria-label=\"\u30d7\u30ed\u30bb\u30b9\u5883\u754c\u306b\u3064\u3044\u3066\u8003\u3048\u308b \u306b\u3064\u3044\u3066\u3055\u3089\u306b\u8aad\u3080\">\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"class_list":["post-3017","post","type-post","status-publish","format-standard","hentry","category-tech"],"_links":{"self":[{"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/posts\/3017","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/comments?post=3017"}],"version-history":[{"count":0,"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/posts\/3017\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/media?parent=3017"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/categories?post=3017"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/tags?post=3017"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}