bc(1) on Solnix vs Linux and the BSDs

On Solnix, bc is the illumos bc at /usr/bin/bc. It is a front end that compiles bc code to dc input and runs dc. It takes only -c and -l, plus files. Linux, NetBSD and FreeBSD ship bc programs with different option sets, and -c means something else on FreeBSD.

What Solnix runs

A default Solnix system runs the illumos /usr/bin/bc. /usr/xpg6/bin/bc is also shipped with the same synopsis. The only documented difference is that with -l the xpg6 page adds 'All math results have the scale of 20.' The /usr/bin/bc page says only that -l initializes scale to 20.

Differences

Compared withTopicWhat differs
FreeBSD-c meaningSolnix -c means compile only: dc commands go to standard output. On FreeBSD, -c (--digit-clamp) turns on clamping of digits at or above ibase, and the page does not describe a compile-only mode. A script using bc -c gets a different behaviour on FreeBSD.
Source: Solnix bc(1) OPTIONS -c; FreeBSD bc(1) OPTIONS -c, --digit-clamp
Linux, NetBSDno -cLinux and NetBSD list no -c option. Their options are -h, -i, -l, -q, -s, -v and -w. Solnix and OpenBSD describe -c as printing the generated dc input instead of running it.
Source: Linux bc(1) OPTIONS; NetBSD bc(1) SYNOPSIS, OPTIONS; Solnix bc(1) OPTIONS -c; OpenBSD bc(1) -c
FreeBSD, OpenBSD-e expressionFreeBSD and OpenBSD bc accept -e to evaluate an expression given on the command line. Solnix bc has no -e; it takes only file operands and then reads standard input, so feed expressions through stdin.
Source: FreeBSD bc(1) -e, --expression; OpenBSD bc(1) SYNOPSIS, -e; Solnix bc(1) SYNOPSIS, OPERANDS
Linux, FreeBSD, NetBSDmissing GNU-style optionsSolnix has no -s, -w, -q, -i or -v and no long options. Linux and NetBSD offer -s/--standard, -w/--warn, -q/--quiet, -i/--interactive and -v/--version. FreeBSD offers similar long options. Scripts passing -q to hide the banner fail on Solnix.
Source: Solnix bc(1) SYNOPSIS; Linux bc(1) OPTIONS; NetBSD bc(1) OPTIONS; FreeBSD bc(1) SYNOPSIS
FreeBSDFreeBSD-only options and environmentFreeBSD bc adds -f, -g, -I ibase, -O obase, -S scale, -E seed, -r keyword, and the environment variables BC_DIGIT_CLAMP and BC_ENV_ARGS. Solnix documents only LANG, LC_ALL, LC_CTYPE, LC_MESSAGES and NLSPATH.
Source: FreeBSD bc(1) SYNOPSIS, OPTIONS, ENVIRONMENT VARIABLES; Solnix bc(1) ENVIRONMENT VARIABLES
OpenBSD&& and || operatorsSolnix bc does not recognize && and ||. OpenBSD documents !, && and || as non-portable extensions. A condition written with && or || works on OpenBSD but not on Solnix.
Source: Solnix bc(1) NOTES; OpenBSD bc(1) Operators
OpenBSDfor statementOn Solnix, a for statement must have all three expressions. On OpenBSD all three may be empty, which the page calls a non-portable extension.
Source: Solnix bc(1) NOTES; OpenBSD bc(1) Statements
Linux, OpenBSD, NetBSD# comments and lastSolnix documents only /* */ comments and has no 'last' variable. Linux, NetBSD and OpenBSD accept # line comments and 'last' as extensions. OpenBSD also accepts a single dot for last. Scripts using # comments will not parse on Solnix.
Source: Solnix bc(1) Comments, Names; Linux bc(1) COMMENTS, VARIABLES; NetBSD bc(1) COMMENTS; OpenBSD bc(1) Comments, Names
OpenBSDif-else, continue, printThe Solnix statement list has if without else, while, for, break and quit. OpenBSD adds if/else, continue and print as non-portable extensions. The Solnix page does not mention them.
Source: Solnix bc(1) Statements; OpenBSD bc(1) Statements
Linux, OpenBSD, NetBSDvariable namesThe Solnix page defines L as a single letter a-z. Linux, NetBSD and OpenBSD allow longer names as an extension, so multi-letter names are not documented on Solnix.
Source: Solnix bc(1) USAGE; Linux bc(1) VARIABLES; NetBSD bc(1) VARIABLES; OpenBSD bc(1) DESCRIPTION
all four-l and scaleSolnix -l defines the math functions and sets scale to 20. The Linux, NetBSD and OpenBSD pages say only that -l defines or includes the math library, and the shown text gives no scale. Set scale explicitly in portable scripts.
Source: Solnix bc(1) OPTIONS -l; Linux bc(1) -l; NetBSD bc(1) -l; OpenBSD bc(1) -l
Linux, FreeBSD, NetBSDimplementationSolnix and OpenBSD describe bc as a preprocessor that runs dc. The Linux and NetBSD pages describe bc as the language processor itself, and FreeBSD calls its bc a drop-in replacement for GNU bc. The Solnix page does not claim GNU compatibility.
Source: Solnix bc(1) DESCRIPTION; OpenBSD bc(1) -c; Linux bc(1) DESCRIPTION; NetBSD bc(1) DESCRIPTION; FreeBSD bc(1) DESCRIPTION
all fourexit statusSolnix documents 0 for success and 'unspecified' for any error, so scripts cannot rely on specific nonzero codes.
Source: Solnix bc(1) EXIT STATUS

Standards

  • POSIX: bc is a POSIX.1-2024 utility.
  • Solnix: ATTRIBUTES: Interface Stability is Standard. SEE ALSO lists standards(7).
  • FreeBSD: bc is described as an interactive processor for a language first standardized in 1991 by POSIX (see its STANDARDS section).
  • OpenBSD: The page cites IEEE Std 1003.1-2008 (“POSIX.1”), which allows relational operators only in the condition of if, while or for.
  • Linux: The page says this bc has extensions beyond traditional bc and the POSIX draft standard; -s processes exactly the POSIX bc language.
  • NetBSD: The page says this bc has extensions beyond traditional bc and the POSIX draft standard; -s processes exactly the POSIX bc language.

Writing portable scripts

  • Use only -l and file or stdin input, for example: echo 'scale=4; 2/3' | bc -l. Avoid -c, -e, -q and long options.
  • Avoid && and ||, # comments, 'last', long variable names and for statements with empty parts. Solnix does not support them.
  • Set scale explicitly in the script instead of relying on -l's default.

Every difference here is taken from the manual pages linked above: Solnix's published page, Linux (man-pages and the GNU and util-linux manuals), FreeBSD, OpenBSD and NetBSD. Each row names its source. Where a manual is silent, this page is too. Compiled 2026-10-26. Found a mistake? Mail hackers@lists.solnix.io.