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.
Asked
Active
Viewed 162 times
2
1 Answers
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

Arkadiusz Drabczyk
- 25,539
${#}
v.$#
) – fra-san Mar 19 '21 at 10:50