I want a script to calculate the sum of the numbers entered by the user.
so far I have:
#!/bin/bash
add() {
sum=0
for num
do
sum=$((sum +num))
done
}
echo "$sum"
the command I use is: add 4 -3 9 12 the
add 4 -3 9 12
the return is: blank line - not the words just a blank line username~/folder:>
what am I missing?
permissions are rwxr xr x
I'm running an interactive shell with the folder in my path, I'm at a loss.