我需要制作这个 bash 脚本:
#!bin/bash
echo "Checking if root…."
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
echo "Not running as root"
exit
fi
echo -ne "Downloading NEW hosts blocking file: "
wget -qO /tmp/hosts.txt http://deathsrepo.webege.com/hosts.txt
echo "DONE!"
mv /tmp/hosts.text -b etc/
wget -qO /tmp/hosts.bak http://deathsrepo.webege.com/hosts.bak
mv /tmp/hosts.bak -b etc/
rename .txt . *.text
能够将 hosts.text 重命名为 hosts。此外,当这个包被删除时,我需要以 hosts.bak 命名。