I'm writing a short script to automate output filenames. The testing folder has the following files:
- test_file_1.fa
- test_file_2.fa
- test_file_3.fa
So far, I have the following:
#!/bin/bash
filenames=$(ls *.fa*)
output_filenames=$()
output_suffix=".output.faa"
for name in $filenames
do
output_filenames+=$name$output_suffix
done
for name in $output_filenames
do
echo $name
done
The output for this is:
test_file_1.fa.output.faatest_file_2.fa.output.faatest_file_3.fa.output.faa
Why does this loop 'stick' all of the filenames together as one array variable?
output_filenames=()