Useful Commands/Arithmetic: Difference between revisions
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 |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
{| class="wikitable" | {| class="wikitable" | ||
! | ! 🎯 Purpose || ⌨️ Command | ||
|- | |- | ||
| 計算整數 || | | 計算整數 || | ||
< | <syntaxhighlight lang="bash"> | ||
echo $((10+5)) | echo $((10+5)) | ||
</ | </syntaxhighlight> | ||
|- | |- | ||
| 計算浮點數 || | | 計算浮點數 || | ||
< | <syntaxhighlight lang="bash"> | ||
bc <<< 'scale=3; 10/3' | bc <<< 'scale=3; 10/3' | ||
bc -l <<< '10/3' | bc -l <<< '10/3' | ||
</ | </syntaxhighlight> | ||
|} | |} | ||
Latest revision as of 02:01, 17 September 2026
| 🎯 Purpose | ⌨️ Command |
|---|---|
| 計算整數 |
echo $((10+5))
|
| 計算浮點數 |
bc <<< 'scale=3; 10/3'
bc -l <<< '10/3'
|