10. Shell Scripting Tutorial for Beginners - Perform Arithmetic Operations

Pubblicato il: 06 settembre 2017
sul canale di: MyShadowbook Programmer
95
3

The Arithmetic expression is a very important feature for performing number arithmetic operations in scripts.
By default, variables are treated as strings in bash scripts.
But parsing a string to numbers is very easy using double parentheses and external command such as expr.

Arithmetic operations in Bash Shell
Arithmetic operations can be done on integers using the following methods

$(( expression ))
echo "Addition = $(( number_1 + number_2 ))"

expr — evaluate the expression
we can also use expr command to perform Arithmetic operations on numbers.

echo "Addition = $(expr $number_1 + $number_2 )"


In questa pagina del sito puoi guardare il video online 10. Shell Scripting Tutorial for Beginners - Perform Arithmetic Operations della durata di ore minuti seconda in buona qualità , che l'utente ha caricato MyShadowbook Programmer 06 settembre 2017, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 95 volte e gli è piaciuto 3 spettatori. Buona visione!