The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: resolv.conf
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 10-13-2008
otheus's Avatar
otheus otheus is offline Forum Staff  
Moderator ala Mode
  
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 1,893
I think you are going about it the wrong way.


Code:
RESOLV=/home/syed/shellscript/resolv.conf
exec <$RESOLV >$RESOLV.new

while read line ; do 
   echo "# $line"
done

echo search.example.com
echo nameserver xxx.xxx.xxxx.xxxx
echo nameserver yyy.yyy.yyyy.yyyy

exec >-
mv $RESOLV $RESOLV.$$.bak 
mv $RESOLV.new $RESOLV


Last edited by otheus; 10-14-2008 at 03:19 AM.. Reason: fixed mistake per learnbash