I recently started learning to code Shell Script and one thing that confuses me is the order of assignment of parameters.
This is the code I have confusion with
#!/bin/bash
Expression()
{
local num3=$1
local num4=$2
local num5=$3
local sum=$(((num3-num4)+num5))
echo $sum
}
num1=5
num2=3
num3=7
sum=$(Expression num1 num2 num3)
echo "The result is $sum"
Instead of getting the output as
The result is 9
Since 5-3+7=9
I'm getting it as
The result is 7
Could anyone explain this please?