Strings In Depth10 / 17
Up next

Substring

#!/usr/bin/env bash
s="abcdefgh"
# ${var:offset:length} extracts a substring
echo "${s:2:3}"
# a negative offset (note the space) counts from the end
echo "${s: -2}"
What you're solving

${s:offset:length} slices a string