I have a script at the moment that reads in variables and then operates on them like the following;
#!bin/bash
a=10
b=15
c=20
d=a*b+c
echo $d
However I would like to split this up into an input file containing:
a=10
b=15
c=20
and a script which does the operation
#!/bin/bash
d=a*b+c
echo $d
And will be called up something like this.
./script.sh < input.in
Now I have done a bit of digging and I have tried doing a simple.
./script.sh < input.in
such that it returns the answer 170
but this doesn't work. After further digging, it seems that in the script in need to use the command "source" But I am unsure how to do it in this case.
Can it be done? What is the best way to do this?