adapting to work with both mac and linux

This commit is contained in:
robocopAlpha 2021-07-15 11:39:45 +03:00
parent 2baf1d1de7
commit daa48b1ced
4 changed files with 102 additions and 64 deletions

View file

@ -1,13 +1,13 @@
#!/usr/bin/env bash
# Facebook & Whatsapp
WRK_DIR=/home/dietpi/pihole_lists
cd ${WRK_DIR}/Mirrors
[[ -f set_env.sh ]] && source set_env.sh || { echo "set_env.sh not found"; exit 1; }
rg -FINv "whatsapp" ${WRK_DIR}/Mirrors/facebook_block.txt >| ${WRK_DIR}/Mirrors/tmp.txt
rg -FIN "whatsapp" ${WRK_DIR}/Mirrors/facebook_block.txt | rg -FIN "facebook" >> ${WRK_DIR}/Mirrors/tmp.txt
rm -f ${WRK_DIR}/Mirrors/facebook_block.txt
sort -u ${WRK_DIR}/Mirrors/tmp.txt | uniq > ${WRK_DIR}/facebook_block.txt
rm -f ${WRK_DIR}/Mirrors/tmp.txt
echo -e " \n $(wc -l ${WRK_DIR}/facebook_block.txt) domains\n"
rg -FINv "whatsapp" "${WRK_DIR}/Mirrors/facebook_block.txt" >| "${WRK_DIR}/Mirrors/tmp.txt"
rg -FIN "whatsapp" "${WRK_DIR}/Mirrors/facebook_block.txt" | rg -FIN "facebook" >> "${WRK_DIR}/Mirrors/tmp.txt"
rm -f "${WRK_DIR}/Mirrors/facebook_block.txt"
sort -u "${WRK_DIR}/Mirrors/tmp.txt" | uniq > "${WRK_DIR}/facebook_block.txt"
rm -f "${WRK_DIR}/Mirrors/tmp.txt"
Line_Count=$(wc -l "${WRK_DIR}/facebook_block.txt")
echo -e "${Line_Count} domains"