Passing a string with spaces as a function argument in Bash

You should add quotes and also, your function declaration is wrong.

myFunction()
{
    echo "$1"
    echo "$2"
    echo "$3"
}

And like the others, it works for me as well.

Leave a Comment