Syntax
Bash String Length Syntax
In Bash, string length: gets the length of a string — ${#name}
Quick Answer
- Syntax
${#name}
BashSyntax
String Length
Gets the length of a string.
How to string length in Bash
- Open your Bash file or editor.
- Copy the example, then replace its sample names and values for your code.
Bash String Length Syntax
Use ${#name}.
Related Syntax References
Frequently asked questions
What is the Bash syntax for string length?
Use this pattern: ${#name}
Can I copy this Bash code example?
Yes. Use Copy code and adapt the example to your program.
Is this Bash syntax different on Mac or Windows?
No. The language syntax is the same across operating systems.
Official source · How we verify