Исправление Grantrol, (текущая версия) :
Да не получается что-то. Вот такая конструкция не работает:
#!/bin/sh
curl --compressed https://adaway.org/hosts.txt \
| grep -vFf /opt/etc/white_list.txt
| awk '{sub("\r$", ""); sub("^www\\.", "", $2); if ($0 && $0 !~ /^#/ && $2 && $2 !~ /^$/ && $2 != "localhost") print "server=/." $2 "/";}' \
| sort -u > /opt/etc/adblock.dnsmasq
if [ ! -e "/opt/etc/init.d/S56dnsmasq" ]; then
restart_dhcpd
else
/opt/etc/init.d/S56dnsmasq restart
fi
Выдает в конце
/opt/bin/adblock_update.sh: line 5: syntax error: unexpected "|"
очищает файл white_list.txt и не применяет исключения прописанные там.
Исходная версия Grantrol, :
Да не получается что-то. Вот такая конструкция не работает:
#!/bin/sh
curl --compressed https://adaway.org/hosts.txt \
| grep -v > /opt/etc/white_list
| awk '{sub("\r$", ""); sub("^www\\.", "", $2); if ($0 && $0 !~ /^#/ && $2 && $2 !~ /^$/ && $2 != "localhost") print "server=/." $2 "/";}' \
| sort -u > /opt/etc/adblock.dnsmasq
if [ ! -e "/opt/etc/init.d/S56dnsmasq" ]; then
restart_dhcpd
else
/opt/etc/init.d/S56dnsmasq restart
fi
Выдает
/opt/home/admin # adblock_update.sh
Usage: grep [OPTION]... PATTERNS [FILE]...
Try 'grep --help' for more information.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
2 81569 2 2091 0 0 3388 0 0:00:24 --:--:-- 0:00:24 5713
curl: (23) Failed writing body (0 != 8514)
/opt/bin/adblock_update.sh: line 5: syntax error: unexpected "|"