From 632a0607c8ce599b5e87d765dfa755cdc99d9db1 Mon Sep 17 00:00:00 2001 From: aloslider <53711835+aloslider@users.noreply.github.com> Date: Thu, 2 Apr 2026 04:29:30 +0300 Subject: [PATCH] Add zsh install script --- run_once_before_11-set-zsh.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 run_once_before_11-set-zsh.sh diff --git a/run_once_before_11-set-zsh.sh b/run_once_before_11-set-zsh.sh new file mode 100755 index 0000000..7f984e9 --- /dev/null +++ b/run_once_before_11-set-zsh.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -euo pipefail + +ZSH_PATH="$(which zsh)" + +if !(grep -q "^$ZSH_PATH$" /etc/shells;) then + echo "$ZSH_PATH" | sudo tee -a /etc/shells > /dev/null + echo "Added $ZSH_PATH to /etc/shells" +fi + +if [[ "$(getent passwd $USER | cut -d: -f7)" != "$ZSH_PATH" ]]; then + chsh -s "$ZSH_PATH" + echo "Set ZSH as default, log out and log back in (or reboot) for the change to take effect" +else + echo "Default shell is already ZSH" +fi