I have a text file with all the numbers from 1 to 1000 (numbers.txt) and I have an executable file (ex2-1) that when it gets all the numbers from 1 to 1000 (it gets the numbers as input one by one) it print "Done!".
When you run the file you see:
please insert 1:
If you enter 1 it shows the same but with 2 and if not it will print "wrong input" and close.
I know how to read from a text file line by line:
#!/bin/bash
filename='numbers.txt'
while read line; do
echo "$line" #echo is just to show where the number is being saved
done < $filename
But is there any way to redirect so that instead of being printed to the screen it will go to the executable file?