Dusko Pijetlovic

My personal notes where I store things I find interesting or might need in the future.

CLI Math [DRAFT]

19 Jul 2024 » cli, terminal, shell, console, math, howto

bc(1)

In tcsh/csh:

$ printf %s\\n "33.59 - 20.45" | bc
13.14

NOTE: You don’t have to use a newline witn printf(1) (that is %s\\n) in FreeBSD in csh (tcsh) shell. You have to use a newline with printf(1) (that is %s\\n) on Apple Mac, a.k.a. macOS, with bash shell.


Footnotes

[1] From the man page for bc(1) on FreeBSD 14:

bc(1) is an interactive processor for a language first standardized in 1991 by POSIX.