Lab 9: UNIX commands, Command line parms

Reminders:

  • Remember that your lab work should take between a minimum of 60 minutes from when lab starts, to a maximum of 90 minutes. Once you are done with your partner lab activity you must give feedback on the work of the groups before and after yours, and fill out the peer evaluation form. After that you are free to go.

  • Your peer evaluation should have an average of 3. We're finding cases where partners are not submitting their outlines, but are still given high scores. This should not be the case. If your partner does not submit an outline, then their preparedness score should be 1.

  • Lab Quizzes will now require a password. All lab work must be done in person.

UNIX is a powerful operating system that is underneath many virtual machines, Android devices, and is the foundation for MacOS. This week we will explore basic UNIX commands used to navigate the file structure, compile and run a program, and send "command line parameters" in to a program to affect its execution.

Reading Preparation

For starters we need a UNIX command line environment to use.

Prepare one of the command line environments for your use, using one of the options shown on the Resources / Command Line Access page.
Do some online research on the following basic UNIX commands, practicing these commands using the environment you installed above. For your outlines create a summary of each of these commands, along with an example of each one in use:
ls, ls -l, ls -a, mv, cp, rm, rm -r, mkdir, cd, pwd, cat, more, man

Post your outline to the the same Reading Outline Submission Form that we've been using each week (except for last week).

In Lab Experience

  1. Paste your outlines showing your explanations and examples of the various UNIX commands. Combine them into a single tutorial of those commands.

  2. Modify the program shown below (and provided in Replit Lab 9 starter code) to use command line parameters to change the program's behavior as follows:

    • -p a switches variable mode to APPEND
      -p
      p switches variable mode to PREPEND
      When mode is mode to APPEND, then new elements are appended to the end of the list. When mode is set to PREPEND, then new elements are prepended to the beginning of the list.

    • -i 0 switches display mode to FALSE
      -i 1 switches display mode to TRUE
      When display mode is TRUE, then after each element is added to the list the list is redisplayed. If it is FALSE then the list is not displayed after each new element is added.

  3. In your slides include the link to your group's program in Replit. Copy / paste examples of your Replit program running with mode set to append and with it set to prepend, and with display mode on and display mode off, using the command line parameters to set these values in your program. You can just have two sample outputs as shown in the example below. You don't have to show all four combinations.

Running your program should look like:

Here is the starter code: