Forrest logo
back to the bc tool

bc:tldr:c5533

bc: Calculate an expression.
$ bc --expression='${5 - 3}'
try on your machine

The command bc --expression='${5 - 3}' is using the bc command-line calculator with a specific mathematical expression as an argument.

  • bc is a command-line calculator that allows you to perform mathematical calculations.
  • --expression is an option or flag for bc that indicates that the following argument is a mathematical expression to be calculated.
  • '${5 - 3}' is the mathematical expression itself enclosed in single quotes.

In this specific expression, ${5 - 3}, we have a subtraction operation.

  • ${} is a Bash shell syntax used for parameter expansion or substitution. It allows you to access the value of a specific bash parameter or variable.
  • 5 and 3 are the values being subtracted.

So, when you execute this command, bc will perform the calculation of 5 - 3, which equals 2. The result 2 will be printed on the terminal output.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the bc tool