Fix bad substitution in bash