I have a text file that contains bash commands for fetching some data from a database. Each command is separated with a newline. See an example below: (the commands could also have been "ls -l", "cat whatever.txt", etc.)
prefetch SRR403012 fastq-dump --fasta 0 SRR403012 my_cpp_program.out SRR403012 ...
How do I create a bash script that executes all these commands? I want something that executes the command in sequential order. However! It's important to note that the commands will take time before termination, because of the enormous files I am fetching. Thus, the for loop should also wait until the execution has finished.
#!/bin/bash FILENAME="my_commands.txt" LINES=$(cat $FILENAME) for LINE in LINES do execute $LINE done