expansion

Bash Scalar length

Returns character count for a scalar in the active locale; array and positional cases differ.

Formal Syntax & Structure

bash syntaxbash
${#p}

Return Value

shell expansion result

Returns character count for a scalar in the active locale; array and positional cases differ.

Working Example

Example Snippetbash
p=helloprintf '%s\n' "${#p}"
Bash Reference