Skip to main content
added 2 characters in body
Source Link
JShorthouse
  • 969
  • 9
  • 16

Pass the name as second argument

function exitIfEmpty()
{
        if [ -z "$1" ]
        then
        echo "Exiting because ${2} is empty"
        exit 1
        fi
}

exitIfEmpty $someKey"$someKey" someKey

Pass the name as second argument

function exitIfEmpty()
{
        if [ -z "$1" ]
        then
        echo "Exiting because ${2} is empty"
        exit 1
        fi
}

exitIfEmpty $someKey someKey

Pass the name as second argument

function exitIfEmpty()
{
        if [ -z "$1" ]
        then
        echo "Exiting because ${2} is empty"
        exit 1
        fi
}

exitIfEmpty "$someKey" someKey
Source Link
JShorthouse
  • 969
  • 9
  • 16

Pass the name as second argument

function exitIfEmpty()
{
        if [ -z "$1" ]
        then
        echo "Exiting because ${2} is empty"
        exit 1
        fi
}

exitIfEmpty $someKey someKey