3rd script
This commit is contained in:
6
TODO.md
6
TODO.md
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
## 1. Project Overview
|
## 1. Project Overview
|
||||||
|
|
||||||
- [ ] Understand the timeline: starts on the first day of INF203, ends on the last week (Sunday midnight).
|
- [x] 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] Plan to stay ahead, especially for the Bash section before C begins.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 2. Preliminaries
|
## 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.
|
- [ ] List all `cowsay` options/arguments in a table or list in your report.
|
||||||
- [ ] Provide examples of executions for each option.
|
- [ ] Provide examples of executions for each option.
|
||||||
|
|
||||||
|
|||||||
18
bash_scripts/cow_highschool.sh
Executable file
18
bash_scripts/cow_highschool.sh
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
if [[ $# -ne 1 ]]; then
|
||||||
|
echo "usage: $0 <number>"
|
||||||
|
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))"
|
||||||
7
bash_scripts/cow_kindergarten.sh
Executable file
7
bash_scripts/cow_kindergarten.sh
Executable file
@@ -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
|
||||||
18
bash_scripts/cow_primaryschool.sh
Executable file
18
bash_scripts/cow_primaryschool.sh
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
if [[ $# -ne 1 ]]; then
|
||||||
|
echo "usage: $0 <number>"
|
||||||
|
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"
|
||||||
Reference in New Issue
Block a user