|
大家晚上好!
我想写一个修改IP的脚本. 我的思路是这样的:
1. 先用命令ifconfig eth0 202.38.248.179
2. 接着修改/etc/hosts文件,在最后加上一句
202.38.248.179 iverison
即/etc/hosts修改后变为
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 iversion localhost.localdomain localhost
202.38.248.179 iverison
即脚本为
#! /bin/bash
echo "please input your IP"
read ip
ipstring=$(echo ""$ip" iversion")
echo ipstring >> /etc/hosts
ifconfig eth0 202.38.248.179
echo "finish"
但是我重启计算机以后我的IP还是原来那个,都没有变,这是怎么回事啊?
请问应该怎样写才对呢?
请各位指教!! |
|