{"id":13465,"date":"2023-08-05T08:40:41","date_gmt":"2023-08-04T23:40:41","guid":{"rendered":"https:\/\/lab4ict.com\/system\/?p=13465"},"modified":"2023-08-05T09:28:36","modified_gmt":"2023-08-05T00:28:36","slug":"bash%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%a6%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%88case%e6%96%87%ef%bc%89","status":"publish","type":"post","link":"https:\/\/lab4ict.com\/system\/archives\/13465","title":{"rendered":"Bash\u3092\u4f7f\u7528\u3057\u3066\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3059\u308b\uff01\uff08case\u6587\uff09"},"content":{"rendered":"<p>Bash\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u3001case\u6587\u306b\u3088\u308b\u6761\u4ef6\u5206\u5c90\u306e\u30ed\u30b8\u30c3\u30af\u3092\u8a18\u8ff0\u3059\u308b\u65b9\u6cd5\u3067\u3059\u3002<br \/>\n<!--more--><\/p>\n<h2>case\u6587\u306e\u66f8\u5f0f\u3092\u78ba\u8a8d\u3059\u308b\uff01<\/h2>\n<p>case\u6587\u306e\u66f8\u5f0f\u306f\u3001\u4ee5\u4e0b\u306b\u306a\u308a\u307e\u3059\u3002\u6761\u4ef6\u5224\u5b9a\u306b\u4f7f\u7528\u3059\u308b\u5909\u6570\u304c\u6587\u5b57\u5217\u306e\u5834\u5408\u306f\u3001\"\u5909\u6570\"\u3068\u3044\u3046\u3088\u3046\u306b\u30c0\u30d6\u30eb\u30af\u30a9\u30fc\u30c8\u3067\u304f\u304f\u308a\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ncase \u5909\u6570 in\r\n    XX )\r\n        #    ;;\r\n    XX ) \r\n        #    ;;\r\n    *)\r\n        #    ;;\r\nesac\r\n<\/pre>\n<h2>\u30b5\u30f3\u30d7\u30eb\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3059\u308b\uff01<\/h2>\n<p>if\u6587\u3067\u6570\u5024\u3068\u6587\u5b57\u5217\u3092\u5224\u5b9a\u3057\u3066\u6761\u4ef6\u5206\u5c90\u3057\u307e\u3059\u3002\u4ee5\u4e0b\u3001\u30b5\u30f3\u30d7\u30eb\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1,15,16,18,20,22,24]; title: ; notranslate\" title=\"\">\r\n$ cat sample_bash_04.sh \r\n#!\/bin\/bash\r\n#\r\n# Usage   : sample_bash_04.sh $1\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\ncase $1 in \r\n    0 )\r\n        echo &quot;case 0&quot; ;;\r\n    1 ) \r\n        echo &quot;case 1&quot; ;;\r\n    2 ) \r\n        echo &quot;case 2&quot; ;;\r\n    * ) \r\n        echo &quot;case *&quot; ;;\r\nesac\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>\u30b5\u30f3\u30d7\u30eb\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3057\u3066\u307f\u308b\uff01<\/h2>\n<p>\u30b5\u30f3\u30d7\u30eb\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1,3,5,7]; title: ; notranslate\" title=\"\">\r\n$ .\/sample_bash_04.sh 0\r\ncase 0\r\n$ .\/sample_bash_04.sh 1\r\ncase 1\r\n$ .\/sample_bash_04.sh 2\r\ncase 2\r\n$ .\/sample_bash_04.sh 3\r\ncase *\r\n<\/pre>\n<h2>\u304a\u308f\u308a\u306b<\/h2>\n<p>case\u6587\u3067\u6761\u4ef6\u5206\u5c90\u306e\u30ed\u30b8\u30c3\u30af\u3092\u8a18\u8ff0\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\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u3001case\u6587\u306b\u3088\u308b\u6761\u4ef6\u5206\u5c90\u306e\u30ed\u30b8\u30c3\u30af\u3092\u8a18\u8ff0\u3059\u308b\u65b9\u6cd5\u3067\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,858,761,680,630,857],"class_list":["post-13465","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-shell-script","tag-bash","tag-case","tag-761","tag-680","tag-630","tag-857"],"_links":{"self":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/13465","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=13465"}],"version-history":[{"count":7,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/13465\/revisions"}],"predecessor-version":[{"id":13472,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/13465\/revisions\/13472"}],"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=13465"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/categories?post=13465"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/tags?post=13465"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}