Operating Systems Concepts & Design
Make sure to return to the AWS Learner Lab page (link in Pilot if you forgot to bookmark it) and hit “Start Lab” to turn on your sandbox / AWS instance
Use ssh
to connect to your AWS Ubuntu instance.
PAUSE AND READ THIS Starting with this lab, you will clone your GitHub repository for your coursework to your AWS instance in addition to having it cloned to your personal system. I would pick from one of two methods since you will now be able to access your repository from two different systems.
Method 1: Only work in the cloned folder on your AWS instance and use git commands to add your changes to commits, make commits, and push changes. If you open the folder on your system (not the instance), you’ll need to pull to synchronize.
Method 2: Create the file for your answers on your system (not the AWS instance), and work on the script on the instance (in your repository folder). As you make changes in the repository folder on one system you will need to remember to make commits, push the changes - and then pull those committed changes on the other system to get the folder up to date.
If a push
/ synchronize seems to fail / is blocked, you likely need to pull
Create a new directory, Lab03
Create a file named README.md
in the Lab03
folder. Copy into the file the contents of the Lab 03 Template.
You may refer to additional resources outside of the recommended resources provided.
Any resource that you use that contributes to your understanding of exercises in this lab should be cited in the Citations
section of your lab answers. To add citations, provide the site and a summary of what it assisted you with. If generative AI was used, include which generative AI system was used and what prompt(s) you fed it.
Generative AI may not write your script for you, only assist with component and how-to type questions.
If you make mistakes with commands in the lab, note them! Writing down what went wrong and what the correction was will significantly help your learning journey. If you cannot find a correction, it will help the TAs or myself understand what point you reached and determine some potential solutions.
In your lab template, fill out the Description column with what the corresponding git
command does. You’ll be using these commands all semester long to interact with your GitHub repository from your AWS instance.
git command | Description |
---|---|
git clone repo_URI |
|
git status |
|
git add filename |
|
git commit |
|
git push |
|
git pull |
Resources
ssh
to your AWS instance for this part. It is highly recommended you look at the Resources listed below.
ssh-keygen
, cat
, git clone
Find out what each command (including its flags) does and write a description beside it. Don’t forget to lookup commands & flags using man
and / or some Google-fu (ability to use Google search) to find out. All of the commands can be run - a note is included if there is any additional setup to make it work.
Sample:
echo "This is easy" > button
echo
prints “This is easy” to standard output, which is redirected to the file named button
in the current directory. button
now contains the text, “This is easy”.printenv HOME > thishouse
cat doesnotexist 2>> hush.txt
cat nums.txt | sort -n >> all_nums.txt
nums.txt
containing random numbers, each on a new linecat << "DONE" > here.txt
ls -lt ~ | head
history | grep ".md"
Resources:
Use your AWS instance for this part. Create the script file in your GitHub repository.
The overall goal is to create a script that randomly generates a set of random numbers within the range specified by the script user. In steps 1 - 5, assume you are rolling one die.
To complete the overall task, perform the steps listed below. After each step is complete and tested, create a commit
with your changes. push
commit
s as you wish, just remember the push
saves all the commit
s to the mighty GitHub cloud. Your commit
message must include which task you completed.
If you don’t make it through all of a step or don’t complete all 6 steps, leave heavy comments for partial credit considerations.
Generative AI may not write your script for you, only assist with component and how-to type questions.
roll
. Output a random number between 1 and 20.
./roll
OR bash roll
is typed on command line. Think about permissions.You rolled a ##
, where ##
is the randomly generated number.Change script to prompt the user for a number. If the number is less than 1, output an error message. Output a random number between 1 and the user’s number.
./roll ##
is typed on command line, where ##
is a numberChange script to also check if the given argument is greater than 1. If no argument was given, prompt user for a number, and check that it was greater than 1. Output a random number between 1 and the number.
Change the script to prompt the user for a valid number if the argument was not provided or was not greater than 1. Prompting continues until a number greater than 1 is given. Output a random number between 1 and the valid number.
./roll ## ##
is typed on command line.Die 1 rolled a ## Die 2 rolled a ##
, where ##
are two randomly generated numbers, one for each die.Resources:
[IO Flood: Bash Shell Scripting | Random Number Generation](https://ioflood.com/blog/bash-random-number/) |
[IO Flood: Bash read man page | Using the Linux read command](https://ioflood.com/blog/bash-read-man-page-using-the-linux-read-command/) |
A retrospective is a moment of refection after a task.
push
ed your commit
s to GitHub, view your commit
history. Did you write good commit
messages that refer to what tasks were completed at each commit? What would you improve?Make a notable improvement to the roll
script. This could be another feature, an additional boundary check on allowed conditions, experimenting with colored text for standard and error output… If you have an idea, you are encouraged to run it by the TAs first to make sure it is worthy.
Make sure you commit
and push
your script changes for grading and add a note of what you did in the answer template.
Lab03
folder in your GitHub repo
Lab03
folder should contain (at minimum):
README.md
roll
roll
script && no commit messages indicating parts building on each other