Bash: Get a substring from a string

Get a substring from a string using Bash substring expansion:

${parameter:offset}
${parameter:offset:length}

The first element index is 0. Example (take all characters from the 4th till the last one):

s=200730
echo ${s:4}
Output: 30

Another example (take two characters starting from the 2nd one):

s=200730
echo ${s:2:2}
Output: 07

Get a substring from a string using cut command:

echo ${s} | cut -c<start>-<end>

The first element index is 1. Example (take characters from the 3rd till the 4th, included):

s=200730
echo ${s} | cut -c3-4
Output: 07