I want to find the length of all my arguments passed to a script.
If I do this: echo ${#1}
I see the length of my first argument, and if I do this: echo $*
I see all my arguments separated by spaces. So, why doesn't it work to do this: echo ${#*}
? Instead this show me the number of arguments passed, as if it was echo $#
.
Is there a way to echo the total length without writing the value of $* to a new variable ($allargs=$*
) and then checking the length of the new variable (echo ${#allargs}
)?