diff --git a/10-greeter.sh b/10-greeter.sh index 824d2393..e098ac3c 100644 --- a/10-greeter.sh +++ b/10-greeter.sh @@ -1,27 +1,27 @@ -#/bin/sh +#!/bin/sh # function in bash -function weekend_greet -{ - echo "Enjoy the weekend! ${1}!" +function weekend_greet { + echo "Enjoy the weekend, $1! Extra greeting: $2" } -function weekday_greet -{ - echo "Hope you are working hard, ${1}!" +function weekday_greet { + echo "Hope you are working hard, $1! Extra greeting: $2" } - -echo "Please enter your name" +echo "Please enter your name:" read name -day=$(date | cut -d' ' -f1) # you can use this form instead of backticks +echo "Enter a greeting or mood:" +read greeting + +day=$(date | cut -d' ' -f1) -if [ $day = "Sat" ] || [ $day = "Sun" ]; then - weekend_greet $name +if [ "$day" = "Sat" ] || [ "$day" = "Sun" ]; then + weekend_greet $name $greeting else - weekday_greet $name + weekday_greet $name $greeting fi # exercise: Add a second argument to the function diff --git a/EyobKabeto/eyob.sh b/EyobKabeto/eyob.sh new file mode 100644 index 00000000..8ae716d8 --- /dev/null +++ b/EyobKabeto/eyob.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +echo "Hello! My name is Eyob Kabeto." +echo "Welcome to my first bash program! What is your name?" +read name +echo "Hi, $name. Nice to see you. Let's play a game!" + +echo "What is 6 + 7?" +read answer + +while [[ "$answer" != "13" ]] +do + echo "Incorrect. Please guess again." + read answer +done + +echo "You got the right answer! Bye bye. See you again." diff --git a/after-merge.png b/after-merge.png new file mode 100644 index 00000000..7d8d3221 Binary files /dev/null and b/after-merge.png differ