What is the story behind ${#} in bash What is the story behind ${#} in bash bash bash

What is the story behind ${#} in bash


${#var} is normally the length in characters of ${var}. So ${#1000000000000000000} is the length of the 1000000000000000000th argument to the script. Since your script wasn't called with that many arguments, this is zero.

Apparently there's a limit on the number of positional parameters, and when you try to refer to a parameter beyond that, the results are unpredictable, and varies from system to system. The dividing line appears to be ${#9223372036854775808}, which is 264.