bash: add missing braces to patch

The patch in 5120c11e broke '\W' outside of the home directory, due to
an unbracketed else block.

Closes #24806.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>