3rd script

This commit is contained in:
2026-04-15 15:35:33 +02:00
parent 6a937b1bd2
commit d5d0b6f608
4 changed files with 46 additions and 3 deletions

18
bash_scripts/cow_highschool.sh Executable file
View 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))"

View 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

View 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"