Created
June 27, 2023 21:25
-
-
Save thiagozs/fa80aa4ce541a07ca11d11d2d8780ff3 to your computer and use it in GitHub Desktop.
Install zsh 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 | |
# Update package lists | |
sudo apt-get update | |
# Check if Zsh is installed, and if not, install it | |
if ! command -v zsh &> /dev/null | |
then | |
echo "Zsh is not installed. Installing..." | |
sudo apt-get install -y zsh | |
else | |
echo "Zsh is already installed." | |
fi | |
# Check if Oh-My-Zsh is installed, and if not, install it | |
if [ ! -d "$HOME/.oh-my-zsh" ] | |
then | |
echo "Oh-My-Zsh is not installed. Installing..." | |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" | |
else | |
echo "Oh-My-Zsh is already installed." | |
fi | |
# Check if zsh-autosuggestions is installed, and if not, install it | |
if [ ! -d "${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions" ] | |
then | |
echo "zsh-autosuggestions is not installed. Installing..." | |
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions | |
else | |
echo "zsh-autosuggestions is already installed." | |
fi | |
# Check if zsh-syntax-highlighting is installed, and if not, install it | |
if [ ! -d "${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting" ] | |
then | |
echo "zsh-syntax-highlighting is not installed. Installing..." | |
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting | |
else | |
echo "zsh-syntax-highlighting is already installed." | |
fi | |
# Check if the plugins are in the .zshrc file, and if not, add them | |
if ! grep -q 'plugins=(git zsh-autosuggestions zsh-syntax-highlighting)' ~/.zshrc | |
then | |
echo "Adding plugins to .zshrc..." | |
echo "plugins=(git zsh-autosuggestions zsh-syntax-highlighting)" >> ~/.zshrc | |
echo "Plugins added." | |
else | |
echo "Plugins are already in .zshrc." | |
fi | |
# Source .zshrc to apply changes immediately | |
source ~/.zshrc | |
echo "Setup complete." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment