String length: Difference between revisions
m
→{{header|UNIX Shell}}: Add note about bytes vs characters in implementations
(→Joy: add) |
m (→{{header|UNIX Shell}}: Add note about bytes vs characters in implementations) |
||
Line 3,612:
=={{header|UNIX Shell}}==
====Byte
{{works with|Bourne Shell}}
Line 3,621 ⟶ 3,620:
====With [[Unix|SUSv3]] parameter expansion modifier:====
This returns the byte count in ash/dash, but the character count in bash, ksh, and zsh:
{{works with|Almquist SHell}}
{{works with|Bourne Again SHell
{{works with|
{{works with|Z SHell}}
<syntaxhighlight lang="bash">string='Hello, world!'
length=
echo $length # if you want it printed to the terminal</syntaxhighlight>
|