Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions 10-greeter.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
#/bin/sh

# function in bash

function weekend_greet
{
echo "Enjoy the weekend! ${1}!"
echo "Enjoy the weekend, $1! You are feeling $2 today!"
}

function weekday_greet
{
echo "Hope you are working hard, ${1}!"
echo "Hello $1, keep pushing! You're feeling $2 today!"
}


echo "Please enter your name"
read name

day=$(date | cut -d' ' -f1) # you can use this form instead of backticks
echo "How are you feeling today?"
read mood

day=$(date | cut -d' ' -f1)

if [ $day = "Sat" ] || [ $day = "Sun" ]; then
weekend_greet $name
weekend_greet $name $mood
else
weekday_greet $name
weekday_greet $name $mood
fi

# exercise: Add a second argument to the function
# and make it give a greeting based on the new
# argument.
# argument.
Binary file added after-merge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions asliee.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
# read the name of the user and print hello

echo "Welcome, my name is Asliee"

Binary file added two-branches.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.