Skip to content

Instantly share code, notes, and snippets.

@EkkoG
Created January 8, 2022 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EkkoG/0a67d8fa482a9554b11375422d7d0fbe to your computer and use it in GitHub Desktop.
Save EkkoG/0a67d8fa482a9554b11375422d7d0fbe to your computer and use it in GitHub Desktop.
#!/bin/bash
check_cmd() {
if ! command -v $1 > /dev/null
then
echo "<$1> could not be found"
if ! command -v brew > /dev/null
then
echo "<brew> could not be found"
echo "Please install Homebrew first"
exit 1
else
if [ $1 == "xcodes" ]
then
brew install robotsandpencils/made/xcodes
else
brew install $1
fi
fi
fi
}
check_cmd xcodes
check_cmd aria2c
version=$(curl https://xcodereleases.com/data.json | jq '.[0].version.number' | sed 's/"//g')
echo $version
if ls ~/Downloads/ | egrep "Xcode-.*$version.*xip";then
echo "已存在"
else
echo "不存在,尝试下载"
xcodes download $version
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment