Forrest logo
back to the echo tool

bc:tldr:22321

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

This command is utilizing the "echo" command to send a mathematical expression '${5 - 3}' as input to the "bc" command.

Here's a breakdown of what each component does:

  • echo: The "echo" command is used to display a line of text or expressions as output.
  • ${5 - 3}: Inside single quotes (' '), this expression represents the mathematical subtraction operation of 5 minus 3.
  • |: This vertical bar is a pipe symbol used to redirect the output of the previous command (echo) to become the input of the next command (bc).
  • bc: The "bc" command stands for "Basic Calculator" and is used for performing mathematical calculations in the command-line interface (CLI). It reads the input from the previous command and evaluates the expression.

So when the command is executed, the value of 5 - 3 is sent to bc for evaluation, and bc will compute the result of the subtraction and display it as 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 echo tool