Refering to this question, I want something a little bit similar. The idea is that I execute a command, then it asks for a file name to process, and after it is done with processing, it asks for the next filename and so on. The problem that I have thousands of files, so I cannot enter them manually one by one. However, I have a .txt file containing all the filenames.
So I wanted to write a bash script which:
- execute the command
- when it asks about a filename, it reads the first line from the txt file
- the program will process the file, then asks for the next
- the bash gives the next and so on
until the program asks for a file, and already the .txt file is done, then I terminate automatically
while read file; do ./program.sh "$file"; done < list.txt
– 0x2b3bfa0 Jul 30 '18 at 13:36