<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>osn_th</author_name>
  <author_url>https://blog.hatena.ne.jp/osn_th/</author_url>
  <blog_title>カタカタブログ</blog_title>
  <blog_url>https://totech.hateblo.jp/</blog_url>
  <categories>
    <anon>Linux</anon>
  </categories>
  <description>シェルスクリプトで外部からデータを受け取り、簡単な四則演算をする処理があったのだが、特殊な数値の場合のみエラーとなる問題が発生した。よくよくデータを見ると、受け取る数値は”01”, “02”のように0始まりの固定2桁の数値フォーマットで、かつ数字が”08”、”09&quot;のときだけエラーとなっていた。結論から言うと、0始まりの数値を演算するときは8進数となり0〜7以外の数値(8,9)を使うとエラーになるためだった。 bashの場合 7以下の数値は8進数演算でも計算結果は正しい $ echo $((01+01)) 2 $ echo $((05+05)) 10 08, 09を使うとエラー $ echo …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ftotech.hateblo.jp%2Fentry%2F2014%2F12%2F05%2F082807&quot; title=&quot;シェルで0始まり整数の演算をすると8進数演算になるので注意 - カタカタブログ&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2014-12-05 08:28:07</published>
  <title>シェルで0始まり整数の演算をすると8進数演算になるので注意</title>
  <type>rich</type>
  <url>https://totech.hateblo.jp/entry/2014/12/05/082807</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
