COMP2101

Lab 4 - Execution Control

This script is designed to give you practice with the skills learned in lesson 4, and practice working with controlling which commands run in your script.

Practice Script:

netid.sh

This exercise practices looping with the for command and a wordlist.

  1. Download the netid.sh script
    wget -O ~/COMP2101/bash/netid.sh https://zonzorp.github.io/COMP2101/Labs/bash/scripts-lab4/netid.sh
    chmod +x ~/COMP2101/bash/netid.sh
    
  2. Run it to see what it does
    netid.sh
    
  3. Modify the script as described in the comments in the script.
  4. Test your changes to be sure they work
    vi ~/COMP2101/bash/netid.sh
    netid.sh
    
  5. Save the final version of your script to your github repository (stage, commit, push).
  6. If anything didn’t work correctly, go back, fix the issues and repeat until it does work right.

Challenge Script:

Further Improvements to sysinfo.sh

This lab will build on the sysinfo.sh script from the previous lab. Keeping all the main goals from the previous labs, your output should be displayed in sections, with titles and all data should be labeled. Only the required data should be present in the output.

In this lab, we are adding content, not so much changing what we are doing. Some of this content will require you to evaluate what output comes from the commands you are using instead of just printing it out.

Add sections to your report, so that the output is visually easier to use.

Report content

A section for system description containing:

A section for CPU information containing:

A section for operating system information containing:

A section for RAM containing:

A section for disk storage containing:

Create, test, and save your script

  1. Create your script as described above.
  2. Test your script to be sure it works as required
    vi ~/COMP2101/bash/sysinfo.sh
    sysinfo.sh
    
  3. If anything didn’t work correctly, go back, fix the issues and repeat until it does work right.
  4. Save the final version of your script to your github repository (git add, git commit -m message, git push).

Grading

There is nothing to submit for this lab. This lab exists to create a useful script and learn to use some important commands. It will provide the basis for the Bash Assignment later in the course which does count towards your semester mark. Ask your professor for help to complete this lab before starting the next lessson in this course if you are unable to complete it on your own.