Adding choose-shell script

This commit is contained in:
Derek Taylor
2025-05-21 15:43:03 -05:00
parent e62729c0b6
commit ed8b3a1e41

46
.local/bin/choose-shell Executable file
View File

@@ -0,0 +1,46 @@
#!/usr/bin/env bash
BOLD='\e[1m'
GREEN='\e[92m'
YELLOW='\e[93m'
RESET='\e[0m'
print_info () {
echo -ne "${BOLD}${YELLOW}$1${RESET}\n"
}
print_choice () {
echo -ne "${BOLD}${GREEN}>> $1${RESET}\n\n"
}
print_info "Choose your user's default shell:"
echo "1. /bin/bash"
echo "2. /bin/fish"
echo "3. /bin/zsh"
read -p "Enter the number of your preferred shell: " choice
case $choice in
1)
chsh -s /bin/bash
print_choice "Shell choice: /bin/bash"
printf '%s\n' "If default shell was changed, you will need to logout and
log back in for change to take effect."
;;
2)
chsh -s /bin/fish
print_choice "Shell choice: /bin/fish"
printf '%s\n' "If default shell was changed, you will need to logout and
log back in for change to take effect."
;;
3)
chsh -s /bin/zsh
print_choice "Shell choice: /bin/zsh"
printf '%s' "If default shell was changed, you will need to logout and
log back in fo\nr change to take effect."
;;
*)
echo "Invalid choice. Please try again."
exit 1
;;
esac