Skip to content

Instantly share code, notes, and snippets.

@upbit
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save upbit/8d8b784f03c88ccec427 to your computer and use it in GitHub Desktop.
Save upbit/8d8b784f03c88ccec427 to your computer and use it in GitHub Desktop.
MacOS用的imouto.host自动更新脚本
#!/bin/bash
IMOUTO_HOST="https://www.dropbox.com/sh/lw0ljk3sllmimpz/AAC-n6LmtWbdlKQRbdEa0QUoa/imouto.host.7z?dl=1"
# download hosts file
curl -L -o imouto.host.7z ${IMOUTO_HOST}
# unzip
./7za x imouto.host.7z imouto.host.txt
awk '{ if (NR==1) sub(/^\xef\xbb\xbf/,""); print }' imouto.host.txt > imouto.host.txt
tr -d '\r' < imouto.host.txt > imouto.host.txt
# deploy to /etc/hosts
echo ">>"
echo ">> may be you want INPUT your sudo password to continue."
echo ">>"
sudo cp imouto.host.txt /etc/hosts
#sudo cat /etc/hosts.other >> /etc/hosts
rm imouto.host.7z imouto.host.txt
cat /etc/hosts | head -n 2 | tail -n 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment