I have a few lists of samples that I need to use, but I don't know how to address them in bash script.
declare -a sample1=("402.fasta" "440.fasta" "410.fasta" "405.fasta")
declare -a sample2=("403.fasta" "360.fasta" "230.fasta" "408.fasta")
.
.
.
declare -a sample9=("400.fasta" "340.fasta" "360.fasta" "436.fasta")
I don't know how to iterate over different values.
I need something like
for((i=1;i<10;i++));
do
for((j=0,j<4;j++));
var=sample$i
echo ${!var[$j]}
done
done
But it only returns 402.fasta, 403.fasta,... 400.fasta, the first file in each sample set!
I have a script that I need to pass files in each set separated by comma to this script, for example
somescript 402.fasta,440.fasta,410.fasta,405.fasta
for((i=1;i<10;i++));
do
somescript ${set$i[0]}, ${set$i[1]},${set$i[2]},${set$i[3]}
done
but ${set$i[3]} doesn't work
And also I need to run LINE_COUNT=$(find . -type f -print0 | wc -l allfilesinset1 | grep "total") echo $LINE_COUNT
If all files in set 1 were in directory1 instead of allfilesinset1 I could use set1/*.fasta but I don't want to change the data sets or cat them together because it takes space, and also I need them individually too.
I think in the over-generalization in the question, and further lack of details makes this difficult to understand. Perhaps write out some psuedocode, to better illustrate the steps you want to complete. I think your end goal is unclear.