Reading 03: Filters

This commit is contained in:
Owen Dorweiler 2025-02-03 02:03:34 -05:00 committed by Peter Bui
commit ceb19b33c2
2 changed files with 42 additions and 0 deletions

11
reading03/Makefile Normal file
View 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/reading03/test_filters.sh
chmod +x test_filters.sh
test-filters:
./test_filters.sh

31
reading03/filters.sh Normal file
View file

@ -0,0 +1,31 @@
#!/bin/bash
q1_answer() {
# TODO: Complete pipeline
echo "Read the fine manual" | tr '[:lower:]' '[:upper:]'.
}
q2_answer() {
# TODO: Complete pipeline
echo "BTW, I use Arch" | sed 's/Arch/Pop/'
}
q3_answer() {
# TODO: Complete pipeline
echo " Yes, do as I say" | sed 's/^ *//'
}
q4_answer() {
# TODO: Complete pipeline
curl -sL https://yld.me/raw/yWh | grep '^root' | cut -d: -f7
}
q5_answer() {
# TODO: Complete pipeline
curl -sL https://yld.me/raw/yWh | grep ':4[0-9]*7:'
}
q6_answer() {
# TODO: Complete pipeline
curl -sL https://yld.me/raw/yWh | sed 's#/bin/\(sh\|bash\|csh\|tcsh\)#/bin/zsh#g' | grep zsh
}