Question: I have a txt file " 80 50 65 100 2 35 1 " and i need to add each number in a Var or even better all of them in an array.
like ...

var1=80
 var2=50 

or

array[0]=80

.by the way the number after that must be functional . I mean i need to be able to 
 sum= $var1 +$var2 
for example. 
Is there a way to do that ? Thank you!!

Answer: 
If your numbers are all on a line, use `read`

```
read -a array < numbers.txt

```

If they're on multiple lines you can change the end of line delimiter like this

```
read -d'\0' -a array < numbers.txt

```

And now you have an array

```
printf 'Number: %s\n' "${array[@]}"

```

Oh yeah, and summing. Lots of ways once you have an array, but how about

```
printf '%s + ' "${array[@]}" | xargs -I{} echo {} 0 | bc

```

Or do it all in one process

```
for n in "${array[@]}" ; do let sum+=$n ; done ; echo $sum

```
In bash, you can say

```
array=( $(< numbers.txt) )
sum=$( IFS=+; echo "${array[*]}" | bc )

```