Minor adjustment from Bash to Zsh

Converting characters to uppercase(/lowercase)

Take variable sayhi for example:

1
2
sayhi="hello there"
echo ${sayhi^^[eo]}

This method of converting lowercase letters to uppercase only works in Bash and will throw and “Bad substitution” error if you try it in Zsh.
Instead, you should use general replacement for this in Zsh:

1
echo ${sayhi//[eo]/[EO]}

Or, for a more Zsh native method, we can try out substitution flags, which comes in two formats:

1
2
3
echo ${sayhi:u}
# Or use it as a prefix:
echo ${(U):sayhi}