{"id":8683,"date":"2023-02-02T05:32:47","date_gmt":"2023-02-01T20:32:47","guid":{"rendered":"https:\/\/lab4ict.com\/system\/?p=8683"},"modified":"2023-08-05T08:03:48","modified_gmt":"2023-08-04T23:03:48","slug":"bash%e3%81%a7%e3%82%b9%e3%82%af%e3%83%aa%e3%83%97%e3%83%88%e3%82%92%e4%bd%9c%e6%88%90%e3%81%99%e3%82%8b%ef%bc%81%ef%bc%88%e5%9f%ba%e6%9c%ac%e3%81%ae%e6%9e%a0%e7%b5%84%e3%81%bf%ef%bc%89","status":"publish","type":"post","link":"https:\/\/lab4ict.com\/system\/archives\/8683","title":{"rendered":"Bash\u3092\u4f7f\u7528\u3057\u3066\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3059\u308b\uff01\uff08\u57fa\u672c\u306e\u67a0\u7d44\u307f\uff09"},"content":{"rendered":"<p>Bash\u3092\u4f7f\u7528\u3057\u3066\u57fa\u672c\u306e\u67a0\u7d44\u307f\u3068\u306a\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<br \/>\n<!--more--><\/p>\n<h2>1\u884c\u76ee\u3092\u8a18\u8ff0\u3059\u308b\uff01<\/h2>\n<p>\u30b9\u30af\u30ea\u30d7\u30c8\u306e1\u884c\u76ee\u306f\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u7d76\u5bfe\u30d1\u30b9\u3067\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\n#!\/bin\/bash\r\n<\/pre>\n<h2>\u30b3\u30e1\u30f3\u30c8\u3092\u8a18\u8ff0\u3059\u308b\uff01<\/h2>\n<p>\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u30b3\u30e1\u30f3\u30c8\u3092\u793a\u3059\u8a18\u53f7\u306f\u3001\u300c#\u300d\u3067\u3059\u3002\u300c#\u300d\u4ee5\u964d\u304c\u30b3\u30e1\u30f3\u30c8\u3068\u5224\u65ad\u3055\u308c\u307e\u3059\u3002\u305f\u3060\u3057\u30011\u884c\u540d\u306e\u300c#!\u300d\u304b\u3089\u59cb\u307e\u308b\u884c\u306f\u3001\u30b3\u30e1\u30f3\u30c8\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<pre class=\"brush: plain; highlight: [2,3,4,5]; title: ; notranslate\" title=\"\">\r\n#!\/bin\/bash\r\n#\r\n# Usage   : sample_bash_01.sh\r\n# Version : 1.0\r\n#\r\n<\/pre>\n<h2>\u74b0\u5883\u5909\u6570\u306e\u521d\u671f\u5316\u3092\u884c\u3046\uff01<\/h2>\n<p>\u4f7f\u7528\u3059\u308b\u74b0\u5883\u5909\u6570\u3084\u5b9a\u6570\u306f\u3001\u6700\u521d\u306b\u521d\u671f\u5316\u3092\u884c\u3044\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"brush: plain; highlight: [6,7,8]; title: ; notranslate\" title=\"\">\r\n#!\/bin\/bash\r\n#\r\n# Usage   : sample_bash_01.sh\r\n# Version : 1.0\r\n#\r\nSHELL_NAME=`basename $0`\r\nSTA_MSG=Start!\r\nEND_MSG=End!\r\n<\/pre>\n<h2>\u51e6\u7406\u3092\u8a18\u8ff0\u3059\u308b\uff01<\/h2>\n<p>\u74b0\u5883\u5909\u6570\u306e\u521d\u671f\u5316\u304c\u7d42\u4e86\u3057\u305f\u3089\u3001\u4e3b\u51e6\u7406\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002\u30b3\u30de\u30f3\u30c9\u3092\u8a18\u8ff0\u3059\u308b\u5834\u5408\u306f\u3001\u306a\u308b\u3079\u304f\u7d76\u5bfe\u30d1\u30b9\u3067\u8a18\u8ff0\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [9,10,11,12,13,14,15,16]; title: ; notranslate\" title=\"\">\r\n#!\/bin\/bash\r\n#\r\n# Usage   : sample_bash_01.sh\r\n# Version : 1.0\r\n#\r\nSHELL_NAME=`basename $0`\r\nSTA_MSG=Start!\r\nEND_MSG=End!\r\n# START\r\n\/usr\/bin\/logger -ip local0.crit -t ${SHELL_NAME} ${STA_MSG}\r\n\r\n# Main\r\necho &quot;${SHELL_NAME} : Main&quot;\r\n\r\n# END\r\n\/usr\/bin\/logger -ip local0.crit -t ${SHELL_NAME} ${END_MSG}\r\n<\/pre>\n<h2>\u51e6\u7406\u3092\u7d42\u4e86\u3059\u308b\uff01<\/h2>\n<p>\u51e6\u7406\u306f\u3001\u300cexit\u300d\u6587\u3067\u7d42\u4e86\u3057\u307e\u3059\u3002\u4e00\u822c\u7684\u306b\u6b63\u5e38\u7d42\u4e86\u306f\u300c0\u300d\u3001\u6b63\u5e38\u7d42\u4e86\u4ee5\u5916\u306f\u3001\u300c0\u300d\u4ee5\u5916\u306e\u623b\u308a\u5024\u3067\u7d42\u4e86\u3059\u308b\u3088\u3046\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [19]; title: ; notranslate\" title=\"\">\r\n#!\/bin\/bash\r\n#\r\n# Usage   : sample_bash_01.sh\r\n# Version : 1.0\r\n#\r\nSHELL_NAME=`basename $0`\r\nSTA_MSG=Start!\r\nEND_MSG=End!\r\n\r\n# START\r\n\/usr\/bin\/logger -ip local0.crit -t ${SHELL_NAME} ${STA_MSG}\r\n\r\n# Main\r\necho &quot;${SHELL_NAME} : Main&quot;\r\n\r\n# END\r\n\/usr\/bin\/logger -ip local0.crit -t ${SHELL_NAME} ${END_MSG}\r\n  \r\nexit 0\r\n<\/pre>\n<h2>\u30b7\u30a7\u30eb\u306b\u5b9f\u884c\u6a29\u3092\u4ed8\u4e0e\u3059\u308b\uff01<\/h2>\n<p>\u30b7\u30a7\u30eb\u306b\u5b9f\u884c\u6a29\u3092\u4ed8\u4e0e\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1,2]; title: ; notranslate\" title=\"\">\r\n$ chmod +x test.sh\r\n$ ls -l sample_bash_01.sh \r\n-rwxr-xr-x. 1 usradmin usradmin 289 Jun 22 07:34 sample_bash_01.sh\r\n<\/pre>\n<h2>\u30b7\u30a7\u30eb\u3092\u5b9f\u884c\u3057\u3066\u307f\u308b\uff01<\/h2>\n<p>\u30b7\u30a7\u30eb\u3092\u5b9f\u884c\u3057\u3066\u3001\u623b\u308a\u5024\u3001\u30ed\u30b0\u51fa\u529b\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1,3,5]; title: ; notranslate\" title=\"\">\r\n$ .\/sample_bash_01.sh \r\nsample_bash_01.sh : Main\r\n$ echo $?\r\n0\r\n$ journalctl -e\r\n...\r\nJun 22 07:39:12 vmsrhe01.loc.lab4ict.com sample_bash_01.sh&#x5B;1607]: Start!\r\nJun 22 07:39:12 vmsrhe01.loc.lab4ict.com sample_bash_01.sh&#x5B;1608]: End!\r\n<\/pre>\n<h2>\u304a\u308f\u308a\u306b<\/h2>\n<p>Bash\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u57fa\u672c\u306e\u67a0\u7d44\u307f\u3092\u4f5c\u6210\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<h2>\u95a2\u9023\u8a18\u4e8b<\/h2>\n<div class=\"sc_getpost\"><a class=\"clearfix\" href=\"https:\/\/lab4ict.com\/system\/archives\/8692\" ><div class=\"sc_getpost_thumb post-box-thumbnail__wrap\"><img decoding=\"async\" src=\"data:image\/gif;base64,R0lGODdhAQABAPAAAN3d3QAAACwAAAAAAQABAAACAkQBADs=\" width=\"150\" height=\"150\" alt=\"\u3010\u8a18\u4e8b\u4e00\u89a7\u3011Linux\u3067\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3059\u308b\uff01\uff08bash\uff09\" loading=\"lazy\" data-src=\"https:\/\/lab4ict.com\/system\/wp-content\/uploads\/2021\/02\/fi_linux_01-150x150.png\" class=\"lazyload\"><\/div><div class=\"title\">\u3010\u8a18\u4e8b\u4e00\u89a7\u3011Linux\u3067\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3059\u308b\uff01\uff08bash\uff09<\/div><div class=\"substr\">Linux\u306ebash\u3067\u3001\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306e\u8a18\u4e8b\u4e00\u89a7\u3067\u3059\u3002...<\/div><\/a><\/div>\n<h2>\u95a2\u9023\u66f8\u7c4d\uff08Amazon\uff09<\/h2>\n<p><iframe sandbox=\"allow-popups allow-scripts allow-modals allow-forms allow-same-origin\" style=\"width:120px;height:240px;\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" frameborder=\"0\" src=\"\/\/rcm-fe.amazon-adsystem.com\/e\/cm?lt1=_blank&bc1=000000&IS2=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=infotecr-22&language=ja_JP&o=9&p=8&l=as4&m=amazon&f=ifr&ref=as_ss_li_til&asins=4774186945&linkId=51dbc0ee6d79ef74ced87300db344bdb\"><\/iframe><\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Bash\u3092\u4f7f\u7528\u3057\u3066\u57fa\u672c\u306e\u67a0\u7d44\u307f\u3068\u306a\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":5527,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[189],"tags":[374,282,761,680,630,853],"class_list":["post-8683","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-shell-script","tag-bash","tag-linux","tag-761","tag-680","tag-630","tag-853"],"_links":{"self":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/8683","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/comments?post=8683"}],"version-history":[{"count":14,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/8683\/revisions"}],"predecessor-version":[{"id":13449,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/8683\/revisions\/13449"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/media\/5527"}],"wp:attachment":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/media?parent=8683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/categories?post=8683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/tags?post=8683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}