diff --git a/TODO.md b/TODO.md index f7506d3..5fcf097 100644 --- a/TODO.md +++ b/TODO.md @@ -2,14 +2,14 @@ ## 1. Project Overview -- [ ] Understand the timeline: starts on the first day of INF203, ends on the last week (Sunday midnight). -- [ ] Plan to stay ahead, especially for the Bash section before C begins. +- [x] Understand the timeline: starts on the first day of INF203, ends on the last week (Sunday midnight). +- [x] Plan to stay ahead, especially for the Bash section before C begins. --- ## 2. Preliminaries -- [ ] Read the `cowsay` manual with `man cowsay`. +- [x] Read the `cowsay` manual with `man cowsay`. - [ ] List all `cowsay` options/arguments in a table or list in your report. - [ ] Provide examples of executions for each option. diff --git a/bash_scripts/cow_highschool.sh b/bash_scripts/cow_highschool.sh new file mode 100755 index 0000000..7242c8c --- /dev/null +++ b/bash_scripts/cow_highschool.sh @@ -0,0 +1,18 @@ +if [[ $# -ne 1 ]]; then + echo "usage: $0 " + echo "please provide exactly one numeric argument" + exit 1 +fi + +if ! [[ "$1" =~ ^[0-9]+$ ]] || (("$1" < 1)); then + echo "error: argument must be a positive integer" + exit 1 +fi + +reset +for ((i = 2; i < "$(($1 + 1))"; i++)); do + cowsay "$((($i - 1) * ($i - 1)))" + sleep 1 + clear +done +cowsay -e oo -T U "$(($1 * $1))" diff --git a/bash_scripts/cow_kindergarten.sh b/bash_scripts/cow_kindergarten.sh new file mode 100755 index 0000000..fa9dcd1 --- /dev/null +++ b/bash_scripts/cow_kindergarten.sh @@ -0,0 +1,7 @@ +reset # To avoid any terminal weirdness +for i in {1..9}; do + cowsay "$i" + sleep 1 + clear # So that they don't stack up +done +cowsay -e oo -T U "10" # Cow that has oo eyes but U tongue diff --git a/bash_scripts/cow_primaryschool.sh b/bash_scripts/cow_primaryschool.sh new file mode 100755 index 0000000..689a1b8 --- /dev/null +++ b/bash_scripts/cow_primaryschool.sh @@ -0,0 +1,18 @@ +if [[ $# -ne 1 ]]; then + echo "usage: $0 " + echo "please provide exactly one numeric argument" + exit 1 +fi + +if ! [[ "$1" =~ ^[0-9]+$ ]] || (("$1" < 1)); then + echo "error: argument must be a positive integer" + exit 1 +fi + +reset +for ((i = 2; i < "$(($1 + 1))"; i++)); do + cowsay "$(($i - 1))" + sleep 1 + clear +done +cowsay -e oo -T U "$1"