diff --git a/mac-os-install.bash b/mac-os-install.bash index a86b3ef..dc97e63 100755 --- a/mac-os-install.bash +++ b/mac-os-install.bash @@ -1,18 +1,33 @@ #!/usr/bin/env bash # If Homebrew is not installed -if ! command -v brew &> /dev/null +if + ! command -v brew &> /dev/null then # Install Homebrew - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" fi # Install dependencies brew install bat fd fish fzf lsd mosh neovim ripgrep stow zoxide # Set fish as a default shell -sudo echo '/usr/local/bin/fish' >> /etc/shells -chsh -s /usr/local/bin/fish + +FISH=`which fish` +SHELLS="/etc/shells" + +if + (test -f $SHELLS) && + (test -z $(grep "$FISH" "$SHELLS")) +then + sudo bash -c "echo \"$FISH\" >> \"$SHELLS\"" +fi + +if + "$SHELL" != "$FISH" +then + chsh -s "$FISH" +fi # Symlink all configurations from .dotfiles stow .