Rechnen in der Shell

closeThis post was published more than three months ago. Please note that the information offered here may no longer be current and valid. Therefore, please inform yourself about this topic elsewhere. If there is any new information, you can also send me a comment. Thank you so much!

Rechnen mit der Bash selbst

echo $(( (11-1)/10*20 ))

Jedoch mach die Bash aus jede Zahl einen Integer Wert. ->

var=11; echo $(( $var/2 ))

Rechnen mit bc

echo "44/3" | bc -l


bc -l <<< "44/3"

Nachkommastellen angepassen

echo "scale=2; 44/3" | bc -l


bc -l <<< "scale=2; 44/3"

weitere Beispiele…

Published by


Lars Moelleken | Ich bin root, ich darf das!

%d bloggers like this: