We're a place where coders share, stay up-to-date and grow their careers.
BASH
if [[ ${#1} > 2 ]]; then echo "${1:1:$(($#1-2))}"; else echo "not validated"; fi
I was surprised to find that -1 to work as well:
-1
V=abcde echo "${V:1:-1}"
BASH
I was surprised to find that
-1
to work as well: