Syntax correction for Bash string extraction