diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 00000000..6c41b07c Binary files /dev/null and b/.DS_Store differ diff --git a/07-beer.sh b/07-beer.sh index b0b033ce..c19dc03e 100644 --- a/07-beer.sh +++ b/07-beer.sh @@ -22,6 +22,72 @@ done # exercise: implement another counting song (such as 12 days of Christmas) # using loops and if statements. +echo "Alright everyone, clear your throats—it's caroling time!" +echo "Now let's sing the 12 Days of Christmas" +echo "----------------------------------------" + +for day in {1..12}; do + # Logic change: Using a case statement for ordinal suffixes (1st, 2nd, etc.) + case $day in + 1) suffix="1st" ;; + 2) suffix="2nd" ;; + 3) suffix="3rd" ;; + *) suffix="${day}th" ;; + esac + + echo "On the $suffix day of Christmas, my true love sent my way:" + + # Logic change: A countdown loop to list gifts in descending order + for (( gift=day; gift>=1; gift-- )); do + case $gift in + 12) echo "Twelve drummers drumming," ;; + 11) echo "Eleven pipers piping," ;; + 10) echo "Ten lords a-leaping," ;; + 9) echo "Nine ladies dancing," ;; + 8) echo "Eight maids a-milking," ;; + 7) echo "Seven swans a-swimming," ;; + 6) echo "Six geese a-laying," ;; + 5) echo "FIVE GOLDEN RINGS!!!" ;; # Extra emphasis + 4) echo "Four calling birds," ;; + 3) echo "Three French hens," ;; + 2) echo "Two turtle doves," ;; + 1) if [ $day -eq 1 ]; then + echo "A partridge in a pear tree." + else + echo "And a partridge in a pear tree!" + fi ;; + esac + done + + echo "...Next verse!" # Extra echo for pacing + echo "" +done + +echo "Whew! Someone get me some eggnog." + +echo "Now let's sing the 12 Days of Christmas" + +day=1 + +while [ $day -le 12 ]; do + echo "On the $day day of Christmas, my true love gave to me" + + if [ $day -ge 1 ]; then echo "a partridge in a pear tree"; fi + if [ $day -ge 2 ]; then echo "two turtle doves"; fi + if [ $day -ge 3 ]; then echo "three french hens"; fi + if [ $day -ge 4 ]; then echo "four calling birds"; fi + if [ $day -ge 5 ]; then echo "five golden rings"; fi + if [ $day -ge 6 ]; then echo "six geese a-laying"; fi + if [ $day -ge 7 ]; then echo "seven swans a-swimming"; fi + if [ $day -ge 8 ]; then echo "eight maids a-milking"; fi + if [ $day -ge 9 ]; then echo "nine ladies dancing"; fi + if [ $day -ge 10 ]; then echo "ten lords a-leaping"; fi + if [ $day -ge 11 ]; then echo "eleven pipers piping"; fi + if [ $day -ge 12 ]; then echo "twelve drummers drumming"; fi + + echo "" + ((day = day + 1)) +done echo "Now we sing about monkeys jumping on the bed" echo "How many monkeys?" diff --git a/after-merge.png b/after-merge.png new file mode 100644 index 00000000..c1f94c4e Binary files /dev/null and b/after-merge.png differ diff --git a/daniel.sh b/daniel.sh new file mode 100755 index 00000000..4dff40f6 --- /dev/null +++ b/daniel.sh @@ -0,0 +1,29 @@ +#!/bin/sh + + +echo "Hello, my name is Daniel" +echo "You are happy?" +read answer + +if [ "$answer" = "yes" ]; then + echo "Smile :)" +else + echo "Still Smile :)" +fi + +# here are the other string comparison operators +# != , -n (not an empty string) , -z (an empty string) + +# exercise: write a script that prints whether today is +# the weekend or not +echo "Which day of the week is today?" +read day + +# Convert input to lowercase to make it case-insensitive +day_lower=$(echo "$day" | tr '[:upper:]' '[:lower:]') + +if [[ "$day_lower" == "saturday" ]] || [[ "$day_lower" == "sunday" ]]; then + echo "Hooray!! Today is the weekend. Enjoy yourself!" +else + echo "Today is a weekday. Keep focused on your work." +fi \ No newline at end of file diff --git a/two-branches.png b/two-branches.png new file mode 100644 index 00000000..a8e47eb8 Binary files /dev/null and b/two-branches.png differ