34 lines
839 B
Bash
Executable File
34 lines
839 B
Bash
Executable File
#!/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
|
|
|