It sounds like you're not using bash at all. I can only reproduce the error you show if I use dash instead of bash:
bash:
$ line="someline content"
$ echo ${line}
someline content
$ lastchars=${line: -5}
$ echo ${lastchars}
ntent
dash:
$ line="someline content"
echo ${line}
lastchars=${line: -5}
echo ${lastchars}
$ someline content
$ dash: 3: Bad substitution
Your shebang line is pointing to bash, but you are running the script with sh, so the shebang is ignored. /bin/sh on Ubuntu systems is actually dash, a minimal shell that doesn't support the syntax you are trying to use.
When using a shebang line, there's no reason to explicitly call a shell for the script, just make it executable (chmod a+x /path/to/script.sh) and run it without specifying an interpreter:
/path/to/script.sh
Alternatively, just use the right one:
bash /path/to/script.sh