{"id":16971,"date":"2015-01-22T21:00:44","date_gmt":"2015-01-22T12:00:44","guid":{"rendered":"http:\/\/www.sssg.org\/blogs\/hiro345\/?p=16971"},"modified":"2015-02-24T06:42:47","modified_gmt":"2015-02-23T21:42:47","slug":"%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89%e3%81%ae%e5%ae%9f%e8%a1%8c%e7%b5%90%e6%9e%9c%e3%82%84%e3%82%a8%e3%83%a9%e3%83%bc%e3%83%a1%e3%83%83%e3%82%bb%e3%83%bc%e3%82%b8%e3%82%92%e7%a0%b4%e6%a3%84%e3%81%99","status":"publish","type":"post","link":"https:\/\/www.hiro345.net\/blogs\/hiro345\/archives\/16971.html","title":{"rendered":"\u30b3\u30de\u30f3\u30c9\u306e\u5b9f\u884c\u7d50\u679c\u3084\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u7834\u68c4\u3059\u308b\u306b\u306f"},"content":{"rendered":"<p>\u6b21\u306e\u3088\u3046\u306a expr_sample0.sh \u304c\u3042\u3063\u305f\u3068\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; gutter: true\">\r\nexpr &quot;$1&quot; + 1 &gt; \/dev\/null\r\nif [ $? -le 1 ]; then\r\n  echo &quot;$1 is number&quot;\r\nelse\r\n  echo &quot;$1 is not number&quot;\r\nfi\r\n<\/pre>\n<p>\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u304d\u306b\u30d1\u30e9\u30e1\u30fc\u30bf\u3078\u6570\u5b57\u3092\u6e21\u3059\u3068\u304d\u306f\u3044\u3044\u306e\u3067\u3059\u304c\u3001\u6587\u5b57\u3092\u6e21\u3057\u3066\u30a8\u30e9\u30fc\u3068\u3059\u308b\u3068\u304d\u306b\u3001expr\u30b3\u30de\u30f3\u30c9\u306e\u30a8\u30e9\u30fc\u3082\u4e00\u7dd2\u306b\u8868\u793a\u3055\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; gutter: true\">\r\n$ sh expr_sample0.sh 1\r\n1 is number\r\n$ sh expr_sample0.sh 2\r\n2 is number\r\n$ sh expr_sample0.sh a\r\nexpr: not a decimal number: &#039;a&#039;\r\na is not number\r\n<\/pre>\n<p>\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u305f\u6642\u306b\u3001\u30b3\u30f3\u30bd\u30fc\u30eb\u753b\u9762\u3078\u30a8\u30e9\u30fc\u304c\u8868\u793a\u3055\u308c\u308b\u3068\u56f0\u308b\u3068\u304d\u3082\u3042\u308b\u306e\u3067\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u4f7f\u3063\u3066\u3044\u308b\u30b3\u30de\u30f3\u30c9\u3067\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u5834\u5408\u306f\u4f55\u3082\u51fa\u529b\u3057\u306a\u3044\u3088\u3046\u306b\u3057\u305f\u3044\u3068\u304d\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n<!--more--><\/p>\n<p>\u305d\u3093\u306a\u3068\u304d\u306f\u3001\u300c\u30b3\u30de\u30f3\u30c9 > \/dev\/null 2>&#038; 1\u300d\u3068\u3057\u307e\u3059\u3002\u3053\u3053\u306e2\u306f\u30a8\u30e9\u30fc\u51fa\u529b\u7528\u306e\u30b9\u30da\u30b7\u30e3\u30eb\u30c7\u30d0\u30a4\u30b9\u30d5\u30a1\u30a4\u30eb\u3067\u30011\u306f\u6a19\u6e96\u51fa\u529b\u7528\u306e\u30b9\u30da\u30b7\u30e3\u30eb\u30c7\u30d0\u30a4\u30b9\u30d5\u30a1\u30a4\u30eb\u3092\u8868\u3057\u3066\u3044\u307e\u3059\u3002expr_sample0.sh \u3078\u9069\u7528\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"brush: bash; gutter: true\">\r\n$ cat expr_sample.sh \r\nexpr &quot;$1&quot; + 1 &gt; \/dev\/null 2&gt;&amp; 1\r\nif [ $? -le 1 ]; then\r\n  echo &quot;$1 is number&quot;\r\nelse\r\n  echo &quot;$1 is not number&quot;\r\nfi\r\n<\/pre>\n<p>\u5b9f\u884c\u7d50\u679c\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u3001expr\u30b3\u30de\u30f3\u30c9\u306e\u5b9f\u884c\u7d50\u679c\u304c\u8868\u793a\u3055\u308c\u306a\u304f\u306a\u3063\u305f\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; gutter: true\">\r\n$  sh expr_sample.sh 2\r\n2 is number\r\n$ sh expr_sample.sh 3\r\n3 is number\r\n$ sh expr_sample.sh a\r\na is not number\r\n<\/pre>\n<div>\n<iframe loading=\"lazy\" style=\"width: 120px; height: 240px;\" src=\"\/\/rcm-jp.amazon.co.jp\/e\/cm?t=hiro345-22&amp;o=9&amp;p=8&amp;l=as1&amp;asins=4873112540&amp;ref=tf_til&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;m=amazon&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr\" height=\"240\" width=\"320\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><iframe loading=\"lazy\" style=\"width: 120px; height: 240px;\" src=\"\/\/rcm-jp.amazon.co.jp\/e\/cm?t=hiro345-22&amp;o=9&amp;p=8&amp;l=as1&amp;asins=4774146439&amp;ref=tf_til&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;m=amazon&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr\" height=\"240\" width=\"320\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><iframe loading=\"lazy\" style=\"width: 120px; height: 240px;\" src=\"\/\/rcm-jp.amazon.co.jp\/e\/cm?t=hiro345-22&amp;o=9&amp;p=8&amp;l=as1&amp;asins=4797321946&amp;ref=tf_til&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;m=amazon&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr\" height=\"240\" width=\"320\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><iframe loading=\"lazy\" style=\"width: 120px; height: 240px;\" src=\"\/\/rcm-jp.amazon.co.jp\/e\/cm?t=hiro345-22&amp;o=9&amp;p=8&amp;l=as1&amp;asins=4774124818&amp;ref=tf_til&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;m=amazon&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr\" height=\"240\" width=\"320\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><iframe loading=\"lazy\" style=\"width: 120px; height: 240px;\" src=\"\/\/rcm-jp.amazon.co.jp\/e\/cm?t=hiro345-22&amp;o=9&amp;p=8&amp;l=as1&amp;asins=4798015954&amp;ref=tf_til&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;m=amazon&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr\" height=\"240\" width=\"320\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div>\n<ul>\n<li><a type=\"amzn\" asin=\"4873112540\">\u5165\u9580bash \u7b2c3\u7248 <\/a><\/li>\n<li><a type=\"amzn\" asin=\"4774146439\">\uff3b\u6539\u8a02\u65b0\u7248\uff3d \u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u57fa\u672c\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u3000\u3000\uff0d\uff0d#!\/bin\/sh\u3067\u3001\u3053\u3053\u307e\u3067\u3067\u304d\u308b (WEB+DB PRESS plus) <\/a><\/li>\n<li><a type=\"amzn\" asin=\"4797321946\">\u5165\u9580UNIX\u30b7\u30a7\u30eb\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u2015\u30b7\u30a7\u30eb\u306e\u57fa\u790e\u304b\u3089\u5b66\u3076UNIX\u306e\u4e16\u754c <\/a><\/li>\n<li><a type=\"amzn\" asin=\"4774124818\">\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8 \u30dd\u30b1\u30c3\u30c8\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9 ~bash\u7de8 (Pocket reference) <\/a><\/li>\n<li><a type=\"amzn\" asin=\"4798015954\">Linux\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8 \u30e6\u30fc\u30b6\u30fc\u4fbf\u5229\u5e33\u2015bash2\/bash3\u5bfe\u5fdc (QUICK MASTER 16)<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6b21\u306e\u3088\u3046\u306a expr_sample0.sh \u304c\u3042\u3063\u305f\u3068\u3057\u307e\u3059\u3002 expr &quot;$1&quot; + 1 &gt; \/dev\/null if [ $? -le 1 ]; then echo &quot;$1 is  &hellip; <a href=\"https:\/\/www.hiro345.net\/blogs\/hiro345\/archives\/16971.html\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[56,1209],"class_list":["post-16971","post","type-post","status-publish","format-standard","hentry","category-linux","tag-bash","tag-linux"],"_links":{"self":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts\/16971","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/comments?post=16971"}],"version-history":[{"count":2,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts\/16971\/revisions"}],"predecessor-version":[{"id":17150,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts\/16971\/revisions\/17150"}],"wp:attachment":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/media?parent=16971"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/categories?post=16971"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/tags?post=16971"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}