String Length and Slices
${#var} gives the length and ${var:start:len} slices.
Example
s="Hello, Bash"
echo ${#s}
echo ${s:7}
echo ${s:0:5}
echo ${s: -4}Result
11 Bash Hello Bash
Exercise
Length.
echo ${s}
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.