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: 
In bash, you can say

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

```
So if you have a file `nums.dat` like

```
80 50 65 100 2 35 1

```

You can read these into an array with

```
read -a MYARRAY < nums.dat

```

If you have a much older `bash` or even `ksh` then it was something like (can't remember exactly sorry)

```
set -A MYARRAY $(cat nums.dat)

```