Everyone:
Next week, we will review for the upcoming Exam 01, which will cover everything from utilizing git, using the shell, scripting the shell, constructing pipelines with filters, and wielding regular expressions.
Because of the exam on Wednesday, February 14, there will be no homework for the upcoming week.
The focus of this reading is to review for the upcoming Exam 01.
The readings for this week are:
This is a non-exhaustive though mostly complete overview of the terms, concepts, and skills you should know for the upcoming exam.
On Friday, we will begin our transition to Python. If you wish to get ahead on snake wrangling, you may wish to begin reading the following:
Scipy Lecture Notes: 1.2. The Python language
This provides a brief overview of the Python programming language.
If you wish for more in-depth material about Python, you can also reference the following resources:
This week, your reading quiz is split into two sections: the first part is your normal dredd quiz, while the second part involves a series of pipelines. The questions are based heavily on Checklist 01.
Record the answers to the following Reading 04 Quiz questions in your
reading04
branch:
For the second part, given the following data about the Teenage Mutant Ninja Turtles:
Leonardo:katana:blue
Donatello:bo:purple
Raphael:sai:red
Michelangelo:nunchucks:orange
You are to complete the following pipelines:
List only the names of the turtles in sorted order.
$ curl -sL https://yld.me/raw/hoUY | ...
Donatello
Leonardo
Michelangelo
Raphael
List only the colors of the turtles in all capitals.
$ curl -sL https://yld.me/raw/hoUY | ...
BLUE
PURPLE
RED
ORANGE
Replace all weapons with plowshares.
$ curl -sL https://yld.me/raw/hoUY | ...
Leonardo:plowshare:blue
Donatello:plowshare:purple
Raphael:plowshare:red
Michelangelo:plowshare:orange
List only the turtles whose names end in lo
.
$ curl -sL https://yld.me/raw/hoUY | ...
Donatello
Michelangelo
List only the turtles with names that have two consecutive vowels.
$ curl -sL https://yld.me/raw/hoUY | ...
Leonardo
Raphael
Count how many colors don't begin with a vowel.
$ curl -sL https://yld.me/raw/hoUY | ...
3
List only the turtles names whose name ends with a vowel and whose weapon ends with a vowel.
$ curl -sL https://yld.me/raw/hoUY | ...
Leonardo
Donatello
List only the colors of the turtles whose name has two of the same
consecutive letter (i.e. aa
, bb
, etc.)
$ curl -sL https://yld.me/raw/hoUY | ...
purple
To record your pipelines, you will need to write your answers to the filters.sh script:
# Download filters template
$ curl -LO https://www3.nd.edu/~pbui/teaching/cse.20289.sp24/static/txt/reading04/filters.sh
Each question has a corresponding function; for instance, the solution for
Question 1 should be recorded in q1_answer
:
#!/bin/bash
q1_answer() {
# TODO: List only the names of the turtles in sorted order.
curl -sL https://yld.me/raw/hoUY | ...
}
To construct your pipelines, you should try them interactively in your shell. Once you found a reasonable solution, you can record them in the filters.sh script under the appropriate function.
To test your pipelines, you need to download the Reading 04 Makefile, which in turn will download the test_filters.sh test script and execute it:
# Download Makefile
$ curl -LO https://www3.nd.edu/~pbui/teaching/cse.20289.sp24/static/txt/reading04/Makefile
# Download test scripts and run test
$ make
...
# Test your filters
$ ./test_filters.sh
Checking reading04 filters.sh ...
Q1 Success
Q2 Success
Q3 Success
Q4 Success
Q5 Success
Q6 Success
Q7 Success
Q8 Success
Score 1.00 / 1.00
Status Success
To submit you work, follow the same process outlined in Reading 01:
$ git switch master # Make sure we are in master branch
$ git pull --rebase # Make sure we are up-to-date with GitHub
$ git checkout -b reading04 # Create reading04 branch and check it out
$ cd reading04 # Go into reading04 folder
$ $EDITOR answers.json # Edit your answers.json file
$ ../.scripts/check.py # Check reading04 quiz
Checking reading04 quiz ...
Q1 0.40
Q2 0.40
Q3 0.40
Q4 0.40
Q5 0.30
Q6 0.30
Q7 0.40
Q8 0.40
Score 3.00 / 3.00
Status Success
$ git add answers.json # Add answers.json to staging area
$ git commit -m "Reading 04: Quiz" # Commit work
$ $EDITOR filters.sh # Edit your filters.sh file
$ ./test_filters.sh # Test your filters
Checking reading04 filters.sh ...
Q1 Success
Q2 Success
Q3 Success
Q4 Success
Q5 Success
Q6 Success
Q7 Success
Q8 Success
Score 1.00 / 1.00
Status Success
$ git add Makefile # Add Makefile to staging area
$ git add filters.sh # Add filters.sh to staging area
$ git commit -m "Reading 04: Filters" # Commit work
$ git push -u origin reading04 # Push branch to GitHub
Remember to create a Pull Request and assign the appropriate TA from the Reading 04 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.