This is a problem that is making me crazy so any help is welcomed :-)
That happens to me mainly when typing scripts with Vim in Mac but I think I got the problem somethimes when typing some commands in the shell but I am not sure. To make the things more complicated, I can't describe a use case case when it happens... just happens :-( !
Everything starts when I try to run a bash scripts I have written using vim and then I get an error like
./script.sh: line 120: [[ 0: command not found
Next step I debug the script adding
and I see
+ '[[ 0' -eq 1 ']]' ./script.sh: line 120: [[ 0: command not found
and If I check the source code I see something like
if [[ $doSth -eq 1 ]]
so it seems that what is between '[[' and $'doSth' is not a space.
Ok, let's show the hidden characters using
and what I get
if [[ $doSth -eq 1 ]]$
so nothing weird. Finally what I did was to see the ASCII characters below the cursor with
:set laststatus=2 :set statusline=%<%f%h%m%r%=%b\ 1x%B\ \ %l,%c%V\ %P
and here I started to see some light:
- The ASCII for a real space is 32
- The ASCII for that character that seems a space is 160
The problem is easy to solve: I remove it and type an space again but .... what is going on?
- Then tmux
- Then vim
So I guess something in the way get wrong but I have no idea what is going on so any help will be more than welcomed :-)