$# mean in shell?
I have code such as
if [ $# -eq 0 ] then
I want to understand what
$# means, but Google search is very bad for searching these kinds of things.
You can always check the man page of your shell.
Therefore a shell script can check how many parameters are given with code like this:
Thus, you can use
Similarly, we have
This is explained in the bash man page in the block "Special Parameters".