script_tool_for_linux.bash: Linux 环境下的 hosts 一键部署脚本
2016-04-17 00:00
861 查看
Linux 环境下的 hosts 一键部署脚本,由 @lstoars 贡献; @fluviusmagnus 提供增强版本。
官方网站:https://github.com/racaljk/hosts/tree/master/hosts_tools
官方网站:https://github.com/racaljk/hosts/tree/master/hosts_tools
#!/bin/sh # # script_tool_for_linux # # Use command: `sudo sh script_tool_for_linux.sh` or # `su -c 'sh script_tool_for_linux.sh'` # to update your hosts file. # # WARNING: the script CAN NOT replace others' hosts rules. # If you have hosts rules provided by others, you may get conflict. # if [ `id -u` -eq 0 ]; then curl -fLo /tmp/fetchedhosts 'https://raw.githubusercontent.com/racaljk/hosts/master/hosts' sed -i '/# Copyright (c) 2014/,/# Modified hosts end/d' /etc/hosts sed -i "s/localhost/`hostname`/g" /tmp/fetchedhosts cat /tmp/fetchedhosts >> /etc/hosts rm -f /tmp/fetchedhosts echo 'Success.' else echo 'Permission denied, are you root?' fi
您可能感兴趣的文章:
script_tool_for_windows.bat Windows 环境下的 hosts 一键部署脚本相关文章推荐
- HTA编辑HOST文件的脚本
- vista hosts修改问题解决
- 批处理利用HOSTS文件(屏蔽,加速)网站的代码
- 利用 bat 文件制作 HOSTS 快速切换器
- 使用批处理bat更改hosts的多个方法
- PHP实现抓取Google IP并自动修改hosts文件
- tools
- host.conf 文件 全部选项解析
- 路由器 DNSMasq 替代 hosts,支持Android、iPhone、PC
- hosts立即生效的方法
- windows 下hosts 文件的作用以及原理
- mysql: Host * is blocked because of many connection errors
- 更改hosts后还是无法使用Google,Facebook,Twitter等服务怎么办?
- Google hosts
- Linux hostname主机名的配置文件/etc/hosts详细介绍
- /etc/hosts文件
- 关于googleapis.com
- MPI和OpenFOAM
- Error start PowerCenter Debugger
- github反应过慢,css加载失败问题