2006-11-17 16:24:38 +00:00
|
|
|
|
|
|
|
\section math math - Perform mathematics calculations
|
|
|
|
|
|
|
|
\subsection math-synopsis Synopsis
|
2014-08-01 12:25:41 +00:00
|
|
|
\fish{synopsis}
|
2014-08-01 02:37:32 +00:00
|
|
|
math EXPRESSION
|
|
|
|
\endfish
|
2006-11-17 16:24:38 +00:00
|
|
|
|
|
|
|
\subsection math-description Description
|
|
|
|
|
2014-08-01 02:37:32 +00:00
|
|
|
`math` is used to perform mathematical calculations. It is a very
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 07:56:01 +00:00
|
|
|
thin wrapper for the bc program, which makes it possible to specify an
|
2006-12-12 17:10:37 +00:00
|
|
|
expression from the command line without using non-standard extensions
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 07:56:01 +00:00
|
|
|
or a pipeline.
|
2006-11-17 16:24:38 +00:00
|
|
|
|
|
|
|
For a description of the syntax supported by math, see the manual for
|
2006-12-12 17:10:37 +00:00
|
|
|
the bc program. Keep in mind that parameter expansion takes place on
|
|
|
|
any expressions before they are evaluated. This can be very useful in
|
2014-04-19 00:16:37 +00:00
|
|
|
order to perform calculations involving shell variables or the
|
2006-12-12 17:10:37 +00:00
|
|
|
output of command substitutions, but it also means that parenthesis
|
|
|
|
have to be escaped.
|
|
|
|
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 07:56:01 +00:00
|
|
|
\subsection math-example Examples
|
|
|
|
|
2014-08-01 02:37:32 +00:00
|
|
|
`math 1+1` outputs 2.
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 07:56:01 +00:00
|
|
|
|
2014-08-01 02:37:32 +00:00
|
|
|
`math $status-128` outputs the numerical exit status of the
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 07:56:01 +00:00
|
|
|
last command minus 128.
|