#!/bin/bash -e

#####################################################
#
# Functions can be defined using the "name () {}"
# notation where the code is contained within the 
# brackets. Functions receive arguments the same way
# a script does, using the "$#" notation.
#
#####################################################

myFunction () {
	if [ "${1}" != "" ]; then
		echo "Your first argument is \"${1}\""
	else
		echo "Called myFunction with no arguments"
	fi
}

# Invoke your function as if it were any other command
# or application located in your $PATH.
myFunction

sleep 2

myFunction "First argument"