You need to run a loop:
while read -r db table; do
./myscript.sh $db $table
done < textfile.txt
Question
I have a script that I execute by:
./myscript.sh database table
This script receives two values $1 and $2
I also have a textfile.txt containing something like this:
database1 table1
database2 table2
database3 table3
database4 table4
...
...
...
I would like to pass the data contained in textfile.txt to my script in one command from the shell. I was thinking something like this:
./myscript.sh | cat textfile.txt
But does not work. Any ideas? Thank you!
Solution
You need to run a loop:
while read -r db table; do
./myscript.sh $db $table
done < textfile.txt