What does $* exactly mean in a shell script?
$*
For example, consider the following code snippet
$JAVA_HOME/bin/java/com/test/Testclass $*
This means that all arguments passed to the script or function are broken into words.
It is usually incorrect and should be replaced with " $@ " , which correctly separates the arguments.
" $@ "
It is easy to find the answer yourself: man bash → /\$\* :
man bash
/\$\*
Special parametersThe shell considers several parameters. These parameters include only links; assignment to them is not permitted.Expands to positional parameters, starting with one. When expansion occurs in double quotes, it expands to one word with the value of each parameter separated by the first character of the IFS special variable. That is "$*" equivalent to "$1c$2c..." , where c is the first character of the value of the IFS variable. If IFS not specified, parameters are separated by spaces. If IFS is null, the parameters are combined without intermediate delimiters.
Special parameters
The shell considers several parameters. These parameters include only links; assignment to them is not permitted.
IFS
"$*"
"$1c$2c..."
c
$* expands to all parameters that were passed to this shell script.
$0 = shell script name
$0
$1 = first argument
$1
$2 = second argument ... etc.
$2
$# = number of arguments passed to shellscript
$#