Skip to content

Instantly share code, notes, and snippets.

@klmr
Created October 12, 2012 11:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klmr/3878725 to your computer and use it in GitHub Desktop.
Save klmr/3878725 to your computer and use it in GitHub Desktop.
Test checksum of gzipped FastQ files after download
#!/bin/bash
set -e
set -u
failed=0
for file in *.fq.gz; do
md5=$(gunzip -c "$file" | openssl md5 | cut -f2 -d " ")
gold=$(grep "${file/.gz/}" md5sums.txt | cut -f2)
if [ "$md5" != "$gold" ]; then
failed=$(($failed + 1))
echo FAILED $file
else
echo SUCCESS $file
fi
done
if [ $failed -gt 0 ]; then
echo $failed downloads failed.
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment