vendredi 6 septembre 2019

How could I use asterisk inside the if-statement with -s in order to check if every file exists

the statement if [ -s "${line}*.fastq" ]; then echo .... seems always false.

The "" quotes seem to preserve the literal value of asterisk.

I found a workaround with just applying the exact regex but I would like to know if there is another, easier/faster way.

my workaround:

while IFS= read -r line; do
 echo "Now downloading "${line}"\n"
 docker run --rm -v "$(pwd)":/data -w /data inutano/sra-toolkit fasterq-dump "${line}" -t /data/shm -e $Processors
 if [[ -s ${line}_1.fastq ]]; then
 echo "Using pigz on ${line}.fastq" 
     pigz --best ${line}*.fastq
 elif [[ -s ${line}.fastq ]]; then 
     pigz --best ${line}*.fastq
 else 
    echo "${line}.fastq not found"
 fi
 done < "$INPUT_txt"    

Aucun commentaire:

Enregistrer un commentaire