2

I could not find any references related to what does ${#} actually means in shell scripting, My rough guess is that it means the last variable passed to an invocation, but not completely sure.

  • Possibly useful: https://unix.stackexchange.com/q/218270/315749 (and https://unix.stackexchange.com/q/4899/315749 if you are wondering about ${#} v. $#) – fra-san Mar 19 '21 at 10:50

1 Answers1

3

No, it means number of positional parameters, the same as $#. For example the following script.sh

#!/usr/bin/env sh

echo ${#}

would print:

$ ./script.sh  arg1 arg2 arg3
3
$ ./script.sh  arg1 arg2 arg3 arg4
4
Stephen Kitt
  • 434,908