alr-repo/hlna-dev-git/postremove.sh

18 lines
643 B
Bash

line_to_remove=('alias hlna="hlna.py"' 'alias hlna-bot="hlna-bot.py"')
file_paths=( "/home/$SUDO_USER/.zshrc" "/home/$SUDO_USER/.bashrc" "/home/$SUDO_USER/.config/fish/config.fish" )
for file_path in "${file_paths[@]}"
do
if [ -f "$file_path" ]; then
# Check if the line is in the file
grep -qF "$line_to_remove" "$file_path"
if [ $? -eq 0 ]; then
sed -i "/$line_to_remove/d" "$file_path"
echo "Строка удалена из $file_path"
else
echo "Строки нет в $file_path"
fi
else
echo "$file_path не существует"
fi
done