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 )"
На этой странице сайта вы можете посмотреть видео онлайн 10. Shell Scripting Tutorial for Beginners - Perform Arithmetic Operations длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь MyShadowbook Programmer 06 Сентябрь 2017, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 95 раз и оно понравилось 3 зрителям. Приятного просмотра!