Skip to content

Instantly share code, notes, and snippets.

@cauu
Last active October 27, 2018 13:48
Show Gist options
  • Save cauu/9c57e558c49ef9eec1f22a8082c47daa to your computer and use it in GitHub Desktop.
Save cauu/9c57e558c49ef9eec1f22a8082c47daa to your computer and use it in GitHub Desktop.
download aeternity newest package
#!/bin/zsh
#Problems:
#1. `` and "" trigger: parse error near `&'
#2. wget -O "filename" "url": dont copy/past in command, do it in script; double quote url;
latest_ae=https://github.com/aeternity/epoch/releases/latest
echo "正在获取ae最新的下载链接..."
ae_url=`curl --silent $latest_ae | grep -n 'href=\".*\"' | cut -d '"' -f 2`
download_path=`curl --silent $ae_url | grep 'href=\".*ubuntu.*\"' | cut -d '"' -f 2`
download_link="https://github.com$download_path"
download_url=`curl --silent $download_link | cut -d '"' -f 2`
#urldecode
final_download_url=$(echo -n $download_url | sed 's/\\/\\\\/g;s/\(%\)\([0-9a-fA-F][0-9a-fA-F]\)/\\x\2/g;s/\&amp\;/\&/g')
echo "最新的下载链接为:"
final_download_url=$(echo -e $final_download_url)
echo "开始下载epoch..."
wget -O 'epoch.tar.gz' "$final_download_url"
# $(echo -e $final_download_url | wget -O 'epoch.tar.gz')
#wget $full_download_url
echo "epoch下载完成..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment