2019-04-21 11:50:48 +08:00

19 lines
1.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<h1 id="let">let</h1>
<p>简单的计算器</p>
<h2 id="补充说明">补充说明</h2>
<p><strong>let命令</strong> 是bash中用于计算的工具提供常用运算符还提供了方幂<code>**</code>运算符。在变量的房屋计算中不需要加上<code>$</code>来表示变量如果表达式的值是非0那么返回的状态值是0否则返回的状态值是1。</p>
<h3 id="语法">语法</h3>
<pre><code class="language-bash">let arg [arg ...] #arg代表运算式</code></pre>
<h3 id="用法">用法</h3>
<p>自加操作<code>let no++</code><br />
自减操作<code>let no--</code><br />
简写形式<code>let no+=10</code><code>let no-=20</code>,分别等同于<code>let no=no+10``let no=no-20</code></p>
<h3 id="实例">实例</h3>
<pre><code class="language-bash">#!/bin/bash
let a=5+4 b=9-3
echo $a $b</code></pre>
<pre><code class="language-bash">#!/bin/bash
let &quot;t1 = ((a = 5 + 3, b = 7 - 1, c = 15 - 4))&quot;
echo &quot;t1 = $t1, a = $a, b = $b&quot;</code></pre>
<!-- Linux命令行搜索引擎https://jaywcjlove.github.io/linux-command/ -->