The idea is that I want to execute a command, then it asks for a file name to process, and after it is done with processing, it outputs an image with the name prediction.png
, it asks for the next filename and so on.
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:
1- execute the command
2- when it asks about a filename, it reads the first line from the txt file
3- the program will process the file, outputs an image, then cp this image to another directory (to avoid overwriting for the next file)
4- then asks for the next, do the same and so on
until the program asks for a file, and already the .txt file is done, then it terminates automatically
What I can do up till now is reading files one by one and passing them as answers for my program when it asks using
cat filenames.txt | ./program.sh
The problem, is that I want to cp
the output before processing the new file
program.sh
?