ta-enlighter-language="shell" class="EnlighterJSRAW">#!/bin/bash
if [ $# -ne 1 ]
then
    echo &#039;Usage: sqrt number&#039;
    exit 1
else
    echo -e &quot;sqrt($1)\nquit\n&quot; | bc -q -i
fi
</pre>
<p>于是，我们可以这样使用这个脚本进行平方根运算：</p>
<pre data-enlighter-language="shell" class="EnlighterJSRAW">[<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d8b0bbb0bdb6988a909d948b8e8aed">[email&#160;protected]</a>]$ ./sqrt 36
6
[<a h