add a line to resolv.conf

view story

http://www.unix.com – Hi, I want to add a search domain name in the beginning of /etc/resolv.conf. If already some '#' symbols are there in the beginning I want to add it below # the search domain which I want to add, the example search domain is "search xxxx.com" So the resolv.conf should be as shown below cat /etc/resolv.conf #domain name entries search xxxx.com aaaaa aaaa.com mmm mmm.com So I want to add the word "search xxxx.com" in the beginning /etc/resolv.conf I tried Code: sed s/.*$/& search xxx.com/ /etc/resolv.conf But this one expects me to create (HowTos)