Argument in shell script never blank

Hi All,

I have a script which accepts a parameter which can either be blank, a specific value, or a wildcard value. But it never seems to be blank and the wildcard option seems to return the names of matching files in my directory. This happens even with the worlds simplest script that just echoes the input, like this :

echo "you passed" $1

I get these results :

#. echo.sh gday
you passed gday

#. echo.sh *t*
you passed 17_11_06.dat

#. echo.sh *tt*
you passed *tt*

The last one was ok because I do not happen to have any files in my directory matching *tt*.

I would like the program to just accept the text as a parameter regardless. I have tried using quotes (eg "*t*") which is even worse as it returns ALL matching files !

Any assistance greatly appreciated ...

Quotes are the solution, but you need to use them when echoing, too.

echo You passed "$1"

or even more properly

echo You passed "$@"