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 |
||
| Line 3: | Line 3: | ||
|- | |- | ||
| 計算整數 || | | 計算整數 || | ||
< | <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 20:24, 3 April 2025
| 情境 | 指令 |
|---|---|
| 計算整數 |
echo $((10+5))
|
| 計算浮點數 |
bc <<< 'scale=3; 10/3'
bc -l <<< '10/3'
|