Bash Script to Swap DNS (/etc/resolv.conf
)
https://youtu.be/o_U76-7LmTQ
WARNING: ONLY DO THIS STUFF IN A CONTAINER FIRST!
- What is DNS?
- Why do I care?
- How would I do this by hand?
- How could we automate this?
- Create a
toggleres
script
- Start by
while read -r line
through file
- Use “recursive descent” approach
- Create states when in section
- Add toggle state if statements
- Use
continue
early to continue line parsing
- Put into function
- Write to temp file
- Copy file over production file