I have this variable, and I want to remove both prefix and suffix:
var="abcde"
echo "${${var#a}%e}"
I tried this snippet in zsh, and it works properly - returns bcd. It uses pattern matching (prefix and suffix).
Although, when I run it in posix compliant shell script (the reason I'm using pattern matching instead of bash string manipulation), I get output bad substitution.
What is the matter? Must I make another variable to store "${var#a}" into or can I do it in one line? I want posix compliant script.