I have a shell script (main.sh) in which first few lines read some data through user's input.
echo "Enter the model !!"
read model
echo "Enter the Weight !!"
read wgt
echo "enter the data file !!"
read datafile
echo "Enter the two column names !!"
read coll1 coll2
these variables $model, $wgt, $datafile, $coll1, $coll2 are being used in the rest of the programs. When I run this by ./main.sh and give inputs respectively MODEL, WGT, DATA, COL1 COL2, everything is running fine. But I want to give these inputs through a file. So I created another script file which contains
echo "COL1 COL2" | echo "DATA" | echo "WGT" | echo "MODEL" | ./main.sh
its only taking the first input i.e. MODEL. Is there any way to do this correctly?