sudo parrot-upgrade更新报错


语法不太懂,帮我看看哪里错了。

啊哦,这不是我写得shell脚本么,让我看看代码

其实是if else语句没加fi结尾才出现的问题,改成如下:

#!/bin/bash
Green_font_prefix="\033[41;37m"
Font_color_suffix="\033[0m"

Info="${Green_font_prefix}[Info]${Font_color_suffix}"

if ping www.baidu.com -c1 >/dev/null 2>&1
then
    echo "update list && install httping"
    (sudo apt --fix-missing update;sudo apt install httping)
    if httping -c1 -g http://www.google.com >/dev/null 2>&1
    then
        sleep 1
        echo -e "${Info} Write stable repository to parrot.list"
        echo "## stable repository" > /etc/apt/sources.list.d/parrot.list
        echo "deb https://deb.parrot.sh/parrot/ rolling main contrib non-free" >> /etc/apt/sources.list.d/parrot.list
        echo "deb https://deb.parrot.sh/parrot/ rolling-security main contrib non-free" >> /etc/apt/sources.list.d/parrot.list
    else
        echo -e "${Info} Can't httping test"
        echo "## ustc" > /etc/apt/sources.list.d/parrot.list
        echo "deb http://mirrors.ustc.edu.cn/parrot/ rolling main contrib non-free" >> /etc/apt/sources.list.d/parrot.list
        echo "deb http://mirrors.ustc.edu.cn/parrot/ rolling-security main contrib non-free" >> /etc/apt/sources.list.d/parrot.list
    fi
else
    echo "Error: No internet!"
    exit 1
fi

echo -e "${Info} --------------<Update && Upgrade parrot>--------------"

set -e
DEBIAN_FRONTEND=noninteractive
apt update || echo failed to update index lists
dpkg --configure -a || echo failed to fix interrupted upgrades
apt --fix-broken --fix-missing install || echo failed to fix conflicts
apt -y --allow-downgrades --fix-broken --fix-missing dist-upgrade

apt autoclean clean 
apt autoremove -y
# rm -rf /var/lib/apt/lists/*
# dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P

echo -e "${Info} --------------<Clean parrot done>--------------"

其实这个脚本现在没什么用,还不如直接proxychains来的直接

1 个赞

服务器资源由ZeptoVM赞助

Partners Wiki Discord