Created
January 8, 2022 16:43
-
-
Save EkkoG/0a67d8fa482a9554b11375422d7d0fbe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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