Week 3 Assignment
PART 1
Your script should do the following:
- Automatically dowload the file found here
- This file generally consists of a hostname, mac address and ip address.
- You need to loop through each line and get it into the correct format Note, the first line doesn’t follow the format, so your script will need to skip it. (Maybe after you download it, you use
head
ortail
) - You cannot use
sed
. Your script should standard output the correct format so dns can use it. Here is some sample dns format:
proxmox1 IN A 144.38.194.118 proxmox2 IN A 144.38.199.115 proxmox3 IN A 144.38.202.116 jdocker IN A 144.38.203.163
Note: You will get the hostname and the ip from the downloaded file.
Sample script invocation should be:
./make_dns.sh
. (And it would display the correct stuff to standard out)
PART 2
Write a script that counts down from 10 to zero. The script should sleep 1
for every iteration of the loop. The script should do the following when the counter is:
- 9, print out your first name
- 8, create a file in your current directory named
eight.txt
- 7, print out the name of the user that has a uid of 1000 on your system. (Hmmm. Maybe
cat /etc/passwd
and grep for 1000, then do some awk magic to get the right value - 6, print out all the users that are logged in (maybe use
who
) - 5, list the files in your current directory
- 4, nothing
- 3, prints ‘danger,danger,danger’
- 2, asks the user if they want to continue. If no, exit the loop.
- 1, prints the last line of some file that you choose
- 0, print “Blast off!”
To pass off
Pass off in class.
Last Updated 02/07/2025