This Is Not The Course Website You Are Looking For

This course website is from a previous semester. If you are currently in the class, please make sure you are viewing the latest course website instead of this old one.

Everyone:

Next week, we will explore some basic networking utilities and then begin learning about shell scripting. That is, we will go from interactively controlling the Unix shell to utilizing the shell as a full-fledged programming language with variables, conditional statements, loops and even functions.

TL;DR

The focus of this reading is some basic networking tools and an introduction to shell scripting in bash.

Readings

The readings for next week are:

  1. The Linux Command Line (Tools):

    • Chapter 16 - Networking
    • Chapter 17 - Searching For Files

  2. The Linux Command Line (Scripting):

    • Chapter 24 - Writing Your First Script
    • Chapter 25 - Starting A Project
    • Chapter 26 - Top-Down Design
    • Chapter 27 - Flow Control: Branching With If
    • Chapter 29 - Flow Control: Loopning With While and Until
    • Chapter 30 - Troubleshooting
    • Chapter 31 - Flow Control: Branching With Case
    • Chapter 32 - Positional Parameters
    • Chapter 33 - Flow Control: Looping With For

    For a shorter version of the scripting chapters, you can read Writing Shell Scripts instead. However, the chapters above are listed to serve as a reference should you need them (they do a more thorough job of explaining the material).

Optional Resources

The following are additional resources that you may find useful:

Shell Scripting

Networking

Terminal Multiplexer

A tool that will be demonstrated in class, but not assessed in the reading quiz or homework is tmux, which is one of the most game-changing programs you could ever learn:

Although not required, it is highly recommended that you learn how to use tmux.

Just For Fun

Try out the following commands at your own discretion:

$ nc towel.blinkenlights.nl 23

Quiz

Once you have completed the readings, answer the following Reading 02 Quiz questions:

Testing

To verify the correctness of your exists.sh script, you should be able to reproduce the following:

$ ls -l                               # List files in reading02 directory
total 8.0K
-rw-r--r-- 1 pbui pbui  23 Jan 18 15:39 README.md
-rw-r--r-- 1 pbui pbui 144 Jan 28 13:37 answers.json
-rwxr-xr-x 1 pbui pbui 254 Jan 28 18:02 exists.sh

$ ./exists.sh * && echo Success       # Run script and check error code
answers.json exists!
exists.sh exists!
README.md exists!
Success

$ ./exists.sh * ASDF || echo Success  # Run script and check error code
answers.json exists!
exists.sh exists!
README.md exists!
ASDF does not exist!
Success

Submission

To submit your work, follow the same process outlined in Reading 01:

$ git checkout master                 # Make sure we are in master branch
$ git pull --rebase                   # Make sure we are up-to-date with GitHub

$ git checkout -b reading02           # Create reading02 branch and check it out

$ cd reading02                        # Go into reading02 folder
$ $EDITOR answers.json                # Edit your answers.json file

$ ../.scripts/check.py                # Check reading02 quiz
Checking reading02 quiz ...
      Q1 1.00
      Q2 0.50
      Q3 0.40
      Q4 0.30
      Q5 1.80
   Score 4.00 / 4.00
  Status Success

$ git add answers.json                # Add answers.json to staging area
$ git commit -m "Reading 02: Done"    # Commit work

$ git push -u origin reading02        # Push branch to GitHub

Pull Request

Remember to create a Pull Request and assign the appropriate TA from the Reading 02 TA List.

DO NOT MERGE your own Pull Request. The TAs use open Pull Requests to keep track of which assignments to grade. Closing them yourself will cause a delay in grading and confuse the TAs.