I am trying to replace all white spaces with _. I used the following code:
FONT="DejaVu Sans Mono"
FONT_CODE=${FONT//[ ]/_}
echo $FONT_CODE
I'm expecting DejaVu_Sans_Mono as the output But I got the following error :
x.sh: 2: Bad substitution
I am not sure what I need to do to get work.
shell
- which shell are you using, specifically? POSIXsh
doesn't support that syntax for example – steeldriver Jun 03 '21 at 00:36./x.sh
. See for example What is the function of bash shebang? – steeldriver Jun 03 '21 at 00:58