Linux Shell Scripting TutorialIntroduction Tools required for shell scripting First shell script Interacting with user Operators Special characters in BASH scripting Variables in Linux BASH scripting Arrays Integer operations floating point operations String manipulation in shell scripting Parameter substitution Command Substitution Conditional statements Looping statements Passing parameters exit status of the script Functions Sourcing files
floating point operations in linux shell scriptingIn this topic, let us learn how to perform operations on floating point numbers in Linux. We know that we can use below ways to perform operations on Integer numbers.
If you try to use floating point numbers in above commands, you will get error saying “non-integer argument” In Linux, we can use “bc” command to perform operations on floating point numbers as shown in below examples.
a=`expr $b + 1` a=$((b+2)) let a=b-1
a=$(echo 2.3 + 3.4 | bc)
Complex problems, Simple Solutions