- Note: In Bash 5.1, a negative length argument in a parameter
substitution (i.e. the `$len` in `${myVar:$start_idx:$len}`) causes
the last characters of the $myVar string to be truncated which is
convenient in various applications. However, a negative length in Bash
3.2.57 (a macOS machine I happen to have) throws an error; for
compatibility, I've instead added an additional arithemetical
operation to calculate the positive length that corresponds to a
truncation by 2 of the total string length.