Created
February 25, 2021 21:00
-
-
Save anthonygelibert/3cec372ef57f273aa1ceac671273c806 to your computer and use it in GitHub Desktop.
Add zero host entry to `/etc/host` from given URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cp /etc/hosts /etc/hosts.tmp | |
echo "# $1" >> /etc/hosts | |
echo "$1" | sed -r 's_https?://([^/]*)/.*_0.0.0.0 \1_' >> /etc/hosts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment