Bash – What does #$ do in bash? (aka: Hash dollar sign, pound dollar sign)


I came across this expression in a bash script and it's really not easy to google for.


Thanks for your help!

Best Solution

#$ does "nothing", as # is starting comment and everything behind it on the same line is ignored (with the notable exception of the "shebang").

$#, as you had it, prints the number of arguments passed to a shell script (like $* prints all arguments).