php/bash script adds a parameter to command line
-s0
came from $10
. That's $1
followed by 0
.
Use ${10}
to access parameter 10. You need curly braces whenever the parameter number is more than one digit.
Note that your code won't work properly if any of the arguments have spaces, because you're not quoting the variables. The variable value will undergo word splitting and wildcard expansion.
But if you quote all the variables, you'll get explicit ''
values for the arguments that weren't supplied, which is probably not desired, either.
The correct way to reference all the arguments is with "$@"
.
php /tmp/check-arg.php "$@"