The shell extends the template. By the time the script was run, the wildcard was expanded, and there is no way for the script to determine if the arguments were wildcards or an explicit list.
This means your script will need help from something else that is not a script. In particular, something that runs before command line processing. This is a bit of an alias. This is your nickname.
alias myscript='set -f; globstopper /usr/bin/myscript'
, "myscript", , - "myscript", , . : -, set -f, globstopper, script .
, globstopper? :
globstopper() {
if [[ "$2" == "*" ]]
then echo "You cannot use a wildcard"
return
fi
set +f
"$@";
}
. -, , script (caveat: , , , , , ). -, . , .
, script. , .
, : ".