Last active
February 23, 2023 20:58
-
-
Save tamsanh/653a45931409fda6fffeec33546e77f1 to your computer and use it in GitHub Desktop.
asdf setup script
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 | |
# Install brew and asdf | |
# Setup Brew | |
brew --help > /dev/null 2>/dev/null | |
if [ $? -ne 0 ]; then | |
## Install if does not exist | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
echo "brew setup complete" | |
else | |
echo "brew already installed" | |
fi | |
# Setup asdf | |
asdf --help > /dev/null 2>/dev/null | |
if [ $? -ne 0 ]; then | |
brew install asdf | |
## Check if zsh plugin is setup | |
cat ~/.zshrc | grep "^plugins" | grep asdf > /dev/null | |
if [ $? -ne 0]; then | |
## Add the asdf plugin | |
sed -i.bu -r "s/^plugins=\((.*)\)/plugins=(\1 asdf)/" ~/.zshrc | |
source ~/.zshrc | |
fi | |
echo "asdf setup complete" | |
else | |
echo "asdf already installed" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment