bc's Examples

this command is used for coand line calculator

$ echo "12+5" |bc

to do mathematical operations

$ bc

bc command along echo

$ echo 3+3 | bc

we can set the number of decimal values to be displayed by using the scale parfameter

$ echo 'scale=4 100/19' | bc

we can get the output of a file

bc < cal.txt

it does the mathematical operations

$ echo "X=10; X+=10;X" | bc

it does the mathematical operations

$ echo " X=14; X*=2; X" | bc

it does boolean operations

$ echo "11>=7" |bc

it does boolean operations

$ echo " 16<=8" | bc

it does boolean operations

$ echo " 16<=8" | bc

DevOpsSchool
Typically replies within an hour

DevOpsSchool
Hi there 👋

How can I help you?
×
Chat with Us