Skip to content

Instantly share code, notes, and snippets.

@akirill0v
Forked from MadratJerry/find-rls-preview.sh
Created May 7, 2019 09:37
Show Gist options
  • Select an option

  • Save akirill0v/fa33ca49b63ff02ff4c247c551434ad7 to your computer and use it in GitHub Desktop.

Select an option

Save akirill0v/fa33ca49b63ff02ff4c247c551434ad7 to your computer and use it in GitHub Desktop.

Revisions

  1. Yotau Hong revised this gist Dec 28, 2017. No changes.
  2. Yotau Hong created this gist Dec 28, 2017.
    15 changes: 15 additions & 0 deletions find-rls-preview.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    #!/bin/bash
    MAC=false
    date -r "$now" +%Y-%m-%d &> /dev/null
    if [ "$?" -ne "0" ]; then echo "LINUX"; MAC=false; else echo 'MAC'; MAC=true; fi

    now=`date +%s`

    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