Files
Dotfiles/run_once_99-set-shell.sh
T
2026-07-30 04:25:19 +02:00

22 lines
563 B
Bash
Executable File

#!/bin/bash
# run_once_99-set-shell.sh
# Sets the user's default login shell to fish.
set -euo pipefail
if ! command -v fish >/dev/null 2>&1; then
echo ">>> [set-shell] fish not installed; skipping"
exit 0
fi
USER_NAME="${USER:-$(id -un)}"
current_shell="$(getent passwd "$USER_NAME" | cut -d: -f7)"
if [ "$current_shell" = "$(command -v fish)" ]; then
echo ">>> [set-shell] shell already set to fish"
exit 0
fi
echo ">>> [set-shell] changing shell for $USER_NAME to $(command -v fish)"
sudo chsh -s "$(command -v fish)" "$USER_NAME" || true