Reading04: Copy files to new branch
This commit is contained in:
parent
241c1e8aec
commit
40f9d35bfd
2 changed files with 54 additions and 0 deletions
11
reading04/Makefile
Normal file
11
reading04/Makefile
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
test:
|
||||
@$(MAKE) -sk test-all
|
||||
|
||||
test-all: test-scripts test-filters
|
||||
|
||||
test-scripts:
|
||||
curl -sLO https://www3.nd.edu/~pbui/teaching/cse.20289.sp25/static/txt/reading04/test_filters.sh
|
||||
chmod +x test_filters.sh
|
||||
|
||||
test-filters:
|
||||
./test_filters.sh
|
||||
43
reading04/filters.sh
Normal file
43
reading04/filters.sh
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#!/bin/bash
|
||||
|
||||
q1_answer() {
|
||||
# TODO: List only the names of the turtles in sorted order.
|
||||
curl -sL https://yld.me/raw/hoUY | cut -d: -f1 | sort
|
||||
}
|
||||
|
||||
q2_answer() {
|
||||
# TODO: List only the colors of the turtles in all capitals.
|
||||
curl -sL https://yld.me/raw/hoUY | curl -sL https://yld.me/raw/hoUY | cut -d: -f3 | tr [a-z] [A-Z]
|
||||
}
|
||||
|
||||
q3_answer() {
|
||||
# TODO: Replace all weapons with plowshares.
|
||||
curl -sL https://yld.me/raw/hoUY | sed 's/:.*:/:plowshare:/'
|
||||
}
|
||||
|
||||
q4_answer() {
|
||||
# TODO: List only the turtles whose names end in lo.
|
||||
curl -sL https://yld.me/raw/hoUY | cut -d: -f1 | grep -E '*lo$'
|
||||
}
|
||||
|
||||
q5_answer() {
|
||||
# TODO: List only the turtles with names that have two consecutive vowels.
|
||||
curl -sL https://yld.me/raw/hoUY | cut -d: -f1 | grep -E '[aeiou]{2}'
|
||||
}
|
||||
|
||||
q6_answer() {
|
||||
# TODO: Count how many colors don't begin with a vowel
|
||||
curl -sL https://yld.me/raw/hoUY | cut -d: -f3 | grep -E '^[^aeiou]' | wc -l
|
||||
}
|
||||
|
||||
q7_answer() {
|
||||
# TODO: 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 | grep -E '^[^:]+[aeiou]:[^:]+[aeiou]:' | cut -d: -f1
|
||||
}
|
||||
|
||||
q8_answer() {
|
||||
# TODO: 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 | grep -E '^[^:]*([a-zA-Z])\1[^:]*:' | cut -d: -f3
|
||||
}
|
||||
Loading…
Reference in a new issue