Skip to content

Instantly share code, notes, and snippets.

@azriel91
Forked from MadratJerry/find-rls-preview.sh
Last active September 16, 2018 07:56
Show Gist options
  • Save azriel91/b20673d287c12337470311d3c2767ee0 to your computer and use it in GitHub Desktop.
Save azriel91/b20673d287c12337470311d3c2767ee0 to your computer and use it in GitHub Desktop.
Find the latest rust nightly version with rls-preview
#!/bin/bash
now=`date +%s`
MAC=false
date -r "$now" +%Y-%m-%d &> /dev/null
if [ "$?" -ne "0" ]; then echo "LINUX"; MAC=false; else echo 'MAC'; MAC=true; fi
while true
do
if [ "$MAC" == "true" ]; then data=`date -r "$now" +%Y-%m-%d`; else data=`date -d @"$now" +%Y-%m-%d`; fi
echo $data
str=`curl -s https://static.rust-lang.org/dist/$data/channel-rust-nightly.toml | grep rls-preview`
if [ "$str" != "" ]; then echo "Bingo!"; break; fi
now=$(($now-86400))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment