If the input file is $file.fastq.gz
, the resulting output file is just that file with the .gz
extension removed.
gunzip "$file.fastq.gz" & gunzip_pid=$!
reads="$file.fastq"
# Do some more work that doesn't depend on the contents of $file.fastq
# ...
wait $gunzip_pid || { echo "Problem with gunzip"; exit; }
# Do something with the now-complete $file.fastq here
(Original answer to misinterpreted question, saved as a useful non-sequitor.)
You need to tell gunzip
to write the uncompressed stream to standard output, rather than uncompressing the file in-place.
reads=$(gunzip -c "$file.fastq.gz") || { echo "Problem with gunzip; exit; }
echo "$reads"