Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please include in the script some comments how the arguments work like the one I attached and encircled. Write a python script called hoster-toaster.py that
Write a python script called hoster-toaster.py that is used to update a machine's local hostname resolution file. The details of how it works are below: It requires one argument on the command line: the absolute path to a file it will read data from. It will use the information in that file to alter the machine's /etc/hosts file. If it is run with no other options, it will overwrite the contents of /etc/hosts using the new data in the file provided as the argument. If the script is run with the option -r it will update the data currently in /etc/hosts with the information in the provided file. If an ip address in the provided file is not already in /etc/hosts, the entry (and its corresponding hostnames) will be added to /etc/hosts. If an ip address in the provided file is already in /etc/hosts, the entry already in /etc/hosts will be replaced entirely. If it is run with the option -v it will add the data from the provided file to whatever is currently in /etc/hosts. Note: This option can not be used in the same run of the command as -r If an ip address in the provided file is not already in /etc/hosts, the entry (and its corresponding hostnames) will be added to /etc/hosts. If an ip address in the provided file is already in /etc/hosts, the hostnames listed for it in the provided file will be added to the ones already in /etc/hosts.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started