Command Substitution (expansion)
You can use the following expressions:
||to the power of|
||remainder – typically used for true false related to evens/odd determination|
💡 It is important to note that you cannot use decimal numbers in bash and any outputs that result in decimal numbers will be truncated to the whole number. This is where the
bccommand will come into play but I’m not going to get too into it just yet.
bccommand is a “basic calculator” that will allow piping into it your expression like this:
"scale=2; 9/2 | bcwhich will result in 4.50. The scale will determine how many decimal places it will use. It’s also good to know that exponents in bc use