The problem:
I want to be able to run a program within a bash loop over each .fna file in a directory, but I also want the name of the output file to have the same file name (without the extension), the problem is that the program uses the single quotes to specify its output file. So when I run my script, it just prints a file called:
outputfile
The code:
for fna in $(find . -name "*.fna")
do
outputname = ${fna%.fna}
outputfile = $outputname.rrna
barrnap $fna --outseq 'outputfile'
done
Example input
A file named:
GCF_000003135.1_ASM313v1_genomic.fna
With an example of the contents:
>NZ_GG666849.1 Bifidobacterium longum subsp. longum ATCC 55813 SCAFFOLD1, whole genome shotgun
sequence
AACCCCGTGGAGTTCACACAACAAGGTGTATTTAGTCAAGTCGGTGTTTCGTGTTTCGTCACTGATTTTTTTCACTGCGG
AAA
Desired output:
An output file from the program named:
GCF_000003135.1_ASM313v1_genomic.rrna
I apologise for the messiness of this, I'm having trouble thinking of the best way of explaining the problem, if anyone can suggest to me an improvement to the title I will instantly change it.