From bbd78f1d82844cf4b21bdfa06e715dd8954b92f7 Mon Sep 17 00:00:00 2001 From: Jacob Franscoviak Date: Tue, 31 Jan 2023 19:06:20 -0500 Subject: [PATCH 1/2] Copy and alteration of file 01 performed --- 01-read_input_copy.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 01-read_input_copy.sh diff --git a/01-read_input_copy.sh b/01-read_input_copy.sh new file mode 100644 index 00000000..9822f7c8 --- /dev/null +++ b/01-read_input_copy.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# read the name of the user and print hello +echo "Welcome, Jacob" + +# single quotes prevent the expansion of the variable + + +# exercise: write a script that asks the user for a +# filename and create an empty file named after it From 03f1cd65c221fd834713fb80b1a593927c0a551f Mon Sep 17 00:00:00 2001 From: Jacob Franscoviak Date: Mon, 6 Feb 2023 22:16:10 -0500 Subject: [PATCH 2/2] alters 07-beer.sh to be the twelve days of christmas --- 07-beer.sh | 235 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 218 insertions(+), 17 deletions(-) diff --git a/07-beer.sh b/07-beer.sh index c03aded6..6ad734e3 100644 --- a/07-beer.sh +++ b/07-beer.sh @@ -1,24 +1,225 @@ #!/bin/sh -echo "Let's sing a beer song" -echo "How many bottles?" -read count +#echo "How many bottles?" +#read count + +#while [ $count -ge 0 ]; do +# if [ $count -ge 2 ]; then +# echo "$count bottles of beer on the wall, $count bottles of beer" +# echo "Take one down pass it around" +# elif [ $count -eq 1 ]; then +# echo "$count bottle of beer on the wall, $count bottles of beer" +# echo "Take one down pass it around" +# else +# echo "no more bottles of beer on the wall" +# fi -while [ $count -ge 0 ]; do - if [ $count -ge 2 ]; then - echo "$count bottles of beer on the wall, $count bottles of beer" - echo "Take one down pass it around" - elif [ $count -eq 1 ]; then - echo "$count bottle of beer on the wall, $count bottles of beer" - echo "Take one down pass it around" - else - echo "no more bottles of beer on the wall" - fi - # the following statement is equivalent to: let "count=count-1" - ((count = count - 1)) +# ((count = count - 1)) -done +#done -# exercise: implement another counting song (such as 12 days of Christmas) +# exercise: implement another counting song (such as 12 days of Christmas) # using loops and if statements. +declare -i count=0 +echo "Lets sing The Twelve Days of Christmas" +while [ $count -lt 12 ]; do + echo "On the first day of Christmas my true love sent to me." + case $count in + 0) + echo "On the first day of Christmas my true love sent to me." + sleep 1 + echo "A partridge in a pear tree" + ;; + 1) + echo "On the second day of Christmas my true love sent to me." + sleep 1 + echo "Two turtle doves" + sleep 1 + echo " and A partridge in a pear tree" + ;; + 2) + echo "On the third day of Christmas my true love sent to me." + sleep 1 + echo "Three french hens" + sleep 1 + echo "Two turtle doves" + sleep 1 + echo "and A partridge in a pear tree" + sleep 1 + ;; + 3) + echo "On the fourth day of Christmas my true love sent to me." + sleep 1 + echo "Four calling birds" + sleep 1 + echo "Three french hens" + sleep 1 + echo "Two turtle doves" + sleep 1 + echo "and A partridge in a pear tree" + ;; + 4) + echo "On the fifth day of Christmas my true love sent to me." + sleep 1 + echo "Five gold rings" + sleep 1 + echo "Four calling birds" + sleep 1 + echo "Three french hens" + sleep 1 + echo "Two turtle doves" + sleep 1 + echo "and A partridge in a pear tree" + ;; + 5) + echo "On the sixth day of Christmas my true love sent to me." + sleep 1 + echo "Six geese a laying" + sleep 1 + echo "Five gold rings" + sleep 1 + echo "Four calling birds" + sleep 1 + echo "Three french hens" + sleep 1 + echo "Two turtle doves" + sleep 1 + echo "and A partridge in a pear tree" + ;; + 6) + echo "On the seventh day of Christmas my true love sent to me." + sleep 1 + echo "Seven swans a-swimming" + sleep 1 + echo "Six geese a laying" + sleep 1 + echo "Five gold rings" + sleep 1 + echo "Four calling birds" + sleep 1 + echo "Three french hens" + sleep 1 + echo "Two turtle doves" + sleep 1 + echo "and A partridge in a pear tree" + ;; + 7) + echo "On the eighth day of Christmas my true love sent to me." + sleep 1 + echo "Eight maids a-milking" + sleep 1 + echo "Seven swans a-swimming" + sleep 1 + echo "Six geese a laying" + sleep 1 + echo "Five gold rings" + sleep 1 + echo "Four calling birds" + sleep 1 + echo "Three french hens" + sleep 1 + echo "Two turtle doves" + sleep 1 + echo "and A partridge in a pear tree" + ;; + 8) + echo "On the ninth day of Christmas my true love sent to me." + sleep 1 + echo "Nine ladies dancing" + sleep 1 + echo "Eight maids a-milking" + sleep 1 + echo "Seven swans a-swimming" + sleep 1 + echo "Six geese a laying" + sleep 1 + echo "Five gold rings" + sleep 1 + echo "Four calling birds" + sleep 1 + echo "Three french hens" + sleep 1 + echo "Two turtle doves" + sleep 1 + echo "and A partridge in a pear tree" + ;; + 9) + echo "On the tenth day of Christmas my true love sent to me." + sleep 1 + echo "Ten lords a-leaping" + sleep 1 + echo "Nine ladies dancing" + sleep 1 + echo "Eight maids a-milking" + sleep 1 + echo "Seven swans a-swimming" + sleep 1 + echo "Six geese a laying" + sleep 1 + echo "Five gold rings" + sleep 1 + echo "Four calling birds" + sleep 1 + echo "Three french hens" + sleep 1 + echo "Two turtle doves" + sleep 1 + echo "and A partridge in a pear tree" + ;; + 10) + echo "On the eleventh day of Christmas my true love sent to me." + sleep 1 + echo "Eleven pipers pipng" + sleep 1 + echo "Ten lords a-leaping" + sleep 1 + echo "Nine ladies dancing" + sleep 1 + echo "Eight maids a-milking" + sleep 1 + echo "Seven swans a-swimming" + sleep 1 + echo "Six geese a laying" + sleep 1 + echo "Five gold rings" + sleep 1 + echo "Four calling birds" + sleep 1 + echo "Three french hens" + sleep 1 + echo "Two turtle doves" + sleep 1 + echo "and A partridge in a pear tree" + ;; + 11) + echo "On the twelfth day of Christmas my true love sent to me." + sleep 1 + echo "Twelve drummers drumming" + sleep 1 + echo "Eleven pipers pipng" + sleep 1 + echo "Ten lords a-leaping" + sleep 1 + echo "Nine ladies dancing" + sleep 1 + echo "Eight maids a-milking" + sleep 1 + echo "Seven swans a-swimming" + sleep 1 + echo "Six geese a laying" + sleep 1 + echo "Five gold rings" + sleep 1 + echo "Four calling birds" + sleep 1 + echo "Three french hens" + sleep 1 + echo "Two turtle doves" + sleep 1 + echo "and A partridge in a pear tree" + ;; + esac + ((count = count + 1)) + sleep 3 +done