[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Updating /etc/hosts automatically / behavior of sed command

Raphaël HALIMI writes:
> Fed up with changing my /etc/hosts file by hand each time my IP adress
> changes (my ISP's server isn't totally stable, and sometimes my IP
> changes even if I don't reboot),...

Why do you feel that you need to have your IP address in your /etc/hosts?

> CURRENT_IP=`/sbin/ifconfig $INTERFACE | grep inet | cut -d ":" -f 2 | cut -d " " -f 1`

CURRENT_IP=`/sbin/route -n | grep $INTERFACE | cut -d ' ' -f 1`

is simpler.
John Hasler
john@dhh.gt.org (John Hasler)
Dancing Horse Hill
Elmwood, WI

Reply to: