Created
September 6, 2015 00:16
-
-
Save krdln/11cdbcf2d3742d40ed7b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# rustdatehash: computes a git commit hash for a nightly from a given date. | |
# Works from about 2015-03-01 | |
# usage: ./rustdatehash yyyy-mm-dd | |
set -e | |
set -u | |
set -o pipefail | |
# not using $1 in grep because the date in version string sometimes doesn't match the argument | |
wget -q -O - https://static.rust-lang.org/dist/$1/rust-nightly-i686-unknown-linux-gnu.tar.gz |\ | |
gunzip -c |\ | |
strings -n 10 |\ | |
grep '([0-9a-z]\{5,\} 20[0-9][0-9]-[0-9][0-9]-[0-9][0-9])' -o |\ | |
grep '[0-9a-z]\{5,\}*' -o |\ | |
head -n 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment