Useful Commands/Arithmetic: Difference between revisions

From Fundamental Ramen
Jump to navigation Jump to search
(Created page with "{| class="wikitable" ! 情境 || 指令 |- | 計算整數 || <source lang="bash"> echo $((10+5)) </source> |- | 計算浮點數 || <source lang="bash"> bc <<< 'scale=3; 10/3'...")
 
No edit summary
 
Line 3: Line 3:
|-
|-
| 計算整數 ||
| 計算整數 ||
<source lang="bash">
<syntaxhighlight lang="bash">
echo $((10+5))
echo $((10+5))
</source>
</syntaxhighlight>
|-
|-
| 計算浮點數 ||
| 計算浮點數 ||
<source lang="bash">
<syntaxhighlight lang="bash">
bc <<< 'scale=3; 10/3'
bc <<< 'scale=3; 10/3'
bc -l <<< '10/3'
bc -l <<< '10/3'
</source>
</syntaxhighlight>
|}
|}

Latest revision as of 20:24, 3 April 2025

情境 指令
計算整數
echo $((10+5))
計算浮點數
bc <<< 'scale=3; 10/3'
bc -l <<< '10/3'