I've the following bash script. It calculates ax^2 + bx + c. Asks for a,b and c as you can see and gets x as a command line argument.
echo "Enter a value for a: "
read a
echo "Enter a value for b: "
read b
echo "Enter a value for c: "
read c
echo Result is `expr $a \* $1 \* $1 + $b \* $1 + $c`.
exit
What I want it to do now is(without any modifications to the above code) that get(override) the values of a, b & c from a file(values listed one after another, all in a line) in command line and skip asking for them in the execution of the script.
I though getopts would be the function for this purpose but I couldn't figure out how to use it. Or is it something else?
Thanks.