# /bin/bash # root 专用 get_github_latest_release() { curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api grep '"tag_name":' | # Get tag line sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value } # 获取最新版本号 tag_name=$(get_github_latest_release "dotnetcore/FastGithub") echo tag_name = $tag_name # 最新版地址: url="https://gh.tj20.top/https://github.com/dotnetcore/FastGithub/releases/download/$tag_name/fastgithub_linux-x64.zip" echo url = $url sudo /usr/fastgithub_linux-x64/fastgithub stop rm -rfv /usr/fastgithub_linux-x64 mkdir -p ~/bin wget --no-check-certificate --content-disposition $url -O -|busybox unzip -d /usr - # sudo chmod +x ~/bin/fastgithub_linux-x64/fastgithub sudo /usr/fastgithub_linux-x64/fastgithub start # 公用 sed -i '/^.*fastgithub.*$/d' ~/.zshrc sed -i '/^\s*export\s\s*all_proxy.*$/d' ~/.zshrc sed -i '/^\s*export\s\s*http[s]_proxy.*$/d' ~/.zshrc cat << EOF >> ~/.zshrc export all_proxy=http://127.0.0.1:38457 EOF source ~/.zshrc