![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| resolv.conf & the internet | stevie_velvet | SUN Solaris | 1 | 08-15-2008 04:26 PM |
| Suse 10 resolv.conf | kjbaumann | SuSE | 2 | 07-15-2008 12:45 PM |
| dns and resolv.conf | b03der | UNIX for Dummies Questions & Answers | 10 | 07-26-2002 04:34 AM |
| /etc/resolv.conf | rpnhavoc | IP Networking | 1 | 02-11-2002 01:04 PM |
| Mail and remote logins & resolv.conf | DGM | IP Networking | 2 | 11-21-2001 11:41 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
resolv.conf
HI ALL
I am making a script,That will does the following,I am in search of ideas 1.Script will comment all existing the entries in resolve.conf 2.Add new entries like this abc.example.com 192.168.1.x I can use sed to add comment. |
|
||||
|
HI Again
I have made the script,In its initial stage,Need to ask one question i am taking backup of reslov.conf with this name reslov.conf~ but a problem is that when next time script run it will over write the backup file with new value.see my code you will get what i m saying ,Please ans this ASAP,its urgent.THX TO ALL Code:
#!/bin/bash sudo sed -i~ 's?^?#?' /home/syed/shellscript/resolv.conf echo search.example.com >> resolv.conf echo nameserver xxx.xxx.x.x >> resolv.conf echo nameserver xxx.xxx.x.x >> resolv.conf cat /home/syed/shellscript/resolv.conf |
|
||||
|
Not working see below
Code:
#! /bin/bash RESOLV=/tmp/reslov.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 tmp]$ ./resolv.sh2 ./resolv.sh2: line 3: /tmp/reslov.conf: No such file or directory ^C |
| Sponsored Links | ||
|
|