I'm a new user that is trying to learn bash, so I'm sorry if my code really bad or "stupid" because I learn bash from free pdf only. My question is: I have a file called "number" that's simply contains
1 3 4 2 9
I want to read it and sum them all together, however my code doesn't work. What I have so far is:
line=$(head -n 1 number)
echo "line"
while read $line
do
sum=`expr $sum + $line`
echo sum
done
Can someone help me to show the correct code? Also, when I call $line is it "1 3 4 2 9" or they split already become "1" "3" "4" "2" "9"?
Thank you.