I am new to bash scripting. I have written a small script containing set of commands using defined declared variables (e.g. SAMPLENAME=Alex) . Now, what I want is to loop this script with different values of declared variables (e.g SAMPLENAME=John) from a file everytime.
For example: I have set following values of variables
#!/bin/bash
tID=000H003HG.TAAGGCGA+GCGATCTA
tSM=Alex
tLB=lib1
O_FOLDER_NAME=HD690_Alex
This is the command which will be executed using abolve values of variables,
bwa mem -V -M -R "@RG\tID:${tID}\tSM:${tSM}\tPL:ILLUMINA\tLB:${tLB}" REFERENCES/$REFERENCE.fa "<zcat OUTPUT/2_TRIMMED_DATA/$O_FOLDER_NAME/split-adapter-quality-trimmed/${O_FOLDER_NAME}-READ1.fastq.gz" "<zcat OUTPUT/2_TRIMMED_DATA/${O_FOLDER_NAME}/split-adapter-quality-trimmed/${O_FOLDER_NAME}-READ2.fastq.gz" > OUTPUT/3_MAPPED_READS/${O_FOLDER_NAME}/aligned_reads.sam
Now after the execution of above command, I want it to loop with following different set of values for declared variables,
#!/bin/bash
tID=000998U3HG.STPUIHY+UIYUSIA
tSM=John
tLB=lib2
O_FOLDER_NAME=HD700_John
Thanks!