From ff0f534ea288961c907a3224873da1abb7d63e0f Mon Sep 17 00:00:00 2001 From: zebra Date: Wed, 24 Jul 2024 16:04:31 -0700 Subject: [PATCH] added script to remove shell tweaks --- remove-shelltweaks.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 remove-shelltweaks.sh diff --git a/remove-shelltweaks.sh b/remove-shelltweaks.sh new file mode 100755 index 0000000..b57675f --- /dev/null +++ b/remove-shelltweaks.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +#Check script is running as root +if [ "$EUID" -ne 0 ] + then echo "Please run as Root" + exit 1 +fi + +apt-get purge fish -y + +# Iterate over each user's home directory, including /root +for homedir in /root /home/*; do + if [ -d "$homedir" ]; then + rm -rf $homedir/.config/fish + rm -rf $homedir/.config/starship.toml + fi +done + + +#Set all users back to bash +echo Reverting users to bash +# Loop through all users in /etc/passwd +while IFS=: read -r username _ _ _ _ homedir _; do + # Skip system accounts and users without a home directory + if [[ $homedir != "/nonexistent" && -d $homedir ]]; then + echo "Changing shell for user: $username" + sudo chsh -s /bin/bash "$username" + if [ $? -ne 0 ]; then + echo "Failed to change shell for user: $username" + fi + fi +done < /etc/passwd +