added script to remove shell tweaks

This commit is contained in:
zebra 2024-07-24 16:04:31 -07:00
parent 54e5ed5918
commit ff0f534ea2

33
remove-shelltweaks.sh Executable file
View File

@ -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