I just set up a VPS with hostinger.com. The OS is Ubuntu 18.04.
I created a user account, mike.
I quickly realised that auto-completion wasn't apparently installed so looked up how you do this.
For some reason (type of shell?) I have to source with a dot, not with the word
Logged in as mike I did this:
sudo apt-get install bash-completion
(NB trying to solve the problem I later tried
sudo apt-get install --reinstall bash-completion)
... and I added this line to /home/mike/.bashrc:
In fact this file consists of one line:
The situation currently is that I can get auto-completion working when logged in as root, by doing this:
$ . /home/mike/.bashrc
But when logged in as mike the same command gives:
$ . /home/mike/.bashrc -su: 26: /usr/share/bash-completion/bash_completion: Syntax error: "(" unexpected
Searching for answers I surmised that the problem might be caused by an alias conflict. But now there are no aliases when logged in as mike and yet the problem persists.
I'm trying (among other things) to understand what "-su: 26" actually means. This appears to be a line reference. But line 26 of that file is in fact blank.
What I'm now thinking of doing is to go through /usr/share/bash-completion/bash_completion, commenting out lines until things start to make sense. But it's a big file!
Obviously one curious aspect of this is that it works when I'm logged in as root but not when logged in as mike.
scp'd my bash_completion file in my local machine to the VPS and used it to replace the existing one (renamed the latter first). Again, sourcing when root worked OK. Again, sourcing when logged in as mike produced (several) errors:
$ . /home/mike/.bashrc -su: 29: /usr/share/bash-completion/bash_completion: [[: not found -su: 35: /usr/share/bash-completion/bash_completion: [[: not found -su: 51: /usr/share/bash-completion/bash_completion: shopt: not found -su: 57: /usr/share/bash-completion/bash_completion: complete: not found -su: 62: /usr/share/bash-completion/bash_completion: complete: not found [... more... ]
Any suggestions? Might it be that the mike account is for some reason using a different shell? A different shell grammar? How might I check this sort of thing?