Re: Updating /etc/hosts automatically / behavior of sed command
On Fri, Jul 05, 2013 at 10:14:54AM +0200, Thomas Hood wrote: Tad Frank wrote: Your issue lies in the line: sed -e s/$REGISTERED_IP/$CURRENT_IP/g /etc/hosts /etc/hosts.new I searched debian-devel for the message to which you are responding; the most recent message with that subject header dates from December 1999. Yes, people were dynamically updating /etc/hosts in 1999 but I hope that no one has to do that any longer. :) -- Thomas Hood And policy allows for /etc to be read-only so the code would be a policy violation. MfG Goswin -- To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20130718133936.GG23957@frosties
Re: Updating /etc/hosts automatically / behavior of sed command
Your issue lies in the line: sed -e s/$REGISTERED_IP/$CURRENT_IP/g /etc/hosts /etc/hosts.new Take a look at the modification I made below, it should help. if [ $CURRENT_IP != $REGISTERED_IP ] ; then echo -n IP address has changed: creating a new /etc/hosts file sed -i.old s/$REGISTERED_IP/$CURRENT_IP/g /etc/hosts echo . else echo IP address hasn't changed: no update needed. fi Hope this helps. ~Tad
Re: Updating /etc/hosts automatically / behavior of sed command
Tad Frank wrote: Your issue lies in the line: sed -e s/$REGISTERED_IP/$CURRENT_IP/g /etc/hosts /etc/hosts.new I searched debian-devel for the message to which you are responding; the most recent message with that subject header dates from December 1999. Yes, people were dynamically updating /etc/hosts in 1999 but I hope that no one has to do that any longer. :) -- Thomas Hood