I have the following code inside a unix file with the name func.sh :
function sum {
var=$1
result=expr $var * 100
echo $result
}
export -f sum
I want to be able to call this function from command line hence i do this :
. ./func.sh
I check whether the function is properly exported or not with the below command : declare -x -F
I can see the line : declare -fx sum
But i am unable to run the function from command line . It gives an error :
sum 10 -bash: 10: command not found
Can someone throw some light on what the issue is here ?