Skip to content

Instantly share code, notes, and snippets.

@tamsanh
Last active February 23, 2023 20:58
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 tamsanh/653a45931409fda6fffeec33546e77f1 to your computer and use it in GitHub Desktop.
Save tamsanh/653a45931409fda6fffeec33546e77f1 to your computer and use it in GitHub Desktop.
asdf setup script
#!/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