Из системы не удаляется пакет Lazarus-а
Нашел тему где с таким же вопросом.
https://askubuntu.com/questions/1471839/error-while-removing-package-lazarus-src-2-2-dpkg-divert-error-file-name-toError while removing package lazarus-src-2.2: dpkg-divert: error: file name 'to' is not an absolute path
Так как у меня такая же ошибка в терминале при всех попытках удаления
"dpkg-divert: ошибка: имя файла «в» указано не с полным путём"
Попробовал приведенный скрипт который чистит пути (где-то там)
Но в нем видимо синтаксическая ошибка.
Вылетает с руганью на 10-ю сроку
./check_err_lazarus.sh: строка 10: синтаксическая ошибка рядом с неожиданным маркером «do»
./check_err_lazarus.sh: строка 10: `For line in $diversions; do'
Можете подсказать как устранить ошибку?
вот сам скрипт
#!/bin/bash
# Get a list of diversions with paths
diversions=$(dpkg-divert --list 'lazarus*')
# Split the output into strings
IFS=$'\n'
# Passing through each line of output
For line in $diversions; do
# Extract the path from the line
path=$(echo $line | awk '{print $2}')
# Execute the command with the path substituted
sudo dpkg-divert --remove --no-rename "$path"
#Remove the rest of the garbage
sudo apt-get install -f
sudo apt autoremove
done
Пользователь добавил сообщение 17 Декабря 2023, 06:59:19:
Сам разобрался.
1. не For, а for (с маленькой буквы)
2. две команды финальные надо вынескти за цикл
в итоге рабочий скрипт
#!/bin/bash
# Get a list of diversions with paths
diversions=$(dpkg-divert --list 'lazarus*')
# Split the output into strings
IFS=$'\n'
# Passing through each line of output
for line in $diversions; do
# Extract the path from the line
path=$(echo $line | awk '{print $2}')
# Execute the command with the path substituted
sudo dpkg-divert --remove --no-rename "$path"
done
#Remove the rest of the garbage
sudo apt-get install -f
sudo apt autoremove