I'm trying to get the checksum of a downloaded file, so I can ensure it gets deployed correctly from an ansible playbook. I discovered that I get two different results depending on whether I download the file first, or just check it via a pipe with curl.
Download and check:
$ wget https://github.com/drush-ops/drush/releases/download/8.1.15/drush.phar
$ sha256sum drush.phar
6999d72e51577b1e20cfaec87152d9905b714f5812861692877b8424a4e2358a drush.phar
Check piped from curl:
$ curl -s https://github.com/drush-ops/drush/releases/download/8.1.15/drush.phar| sha256sum
c703007cf15cbabbeb510031ded52e7482f85dd3cce037bf9bcb7d7749acaa23 -
You'd think they would be the same result?
Mystery solved.
The original URL has redirects, which I need to tell curl
to follow with the -L
switch:
$ curl -sL https://github.com/drush-ops/drush/releases/download/8.1.15/drush.phar| sha256sum
6999d72e51577b1e20cfaec87152d9905b714f5812861692877b8424a4e2358a -
Voila. Now the checksums match.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With