Hello, I am trying to write a small fixlet that asks the user for two inputs for new DNS server ip addresses and uses that input to append two lines in two files. The lines start with “DNS1=” and “DNS2=” respectively. Both lines exist in both files.
The files are:
/etc/sysconfig/network-scripts/ifcfg-ens192
/etc/sysconfig/network-scripts/ifcfg-ens224
These files will populate resolv.conf nameserver entries. My thought was to find lines in these files that start with “DNS1” or starts with “DNS2” and append the line with user input after the “=”.
In other words, if line starts with “DNS1” then append line after the first “=” with the user input for primary DNS server. If line starts with “DNS2” then append line after the fist “=” with the user input for the secondary DNS server. Then do this for both files.
This turned out to be well over my head, I have the prompts working just fine, but I have nothing else. I’ve looked in the forums and found similar posts, but nothing close enough to give me the push in the right direction.
Any help would be greatly appreciated. Thank you.