string length expansion

The ${#name} form, which expands to the number of characters in a variable, or ${#array[@]} for the number of elements.

In more detail

It only works inside curly braces. For an array, putting the at sign inside gives the element count rather than the length of the first element.

Examples

echo "${#name}"
echo "${#files[@]}"

Related terms

Taught in

References