Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bash_completion not working, source command not found

I recently inherited a Ubuntu Hardy box that acts rather funky out-of-the-box. The first things I tried to do was edit my .bashrc profile to do some coloring and add some aliases I usually have, but then when I try to source the ~/.bashrc I get sh: source: not found and I have also noticed tabbed autocomplete is also not working at all - I believe this is called bash_completetion, but as I'm sure you can tell, I'm not an expert.

Are there any specific files I should be editing to get this basic functionality I am accustomed to out-of-the-box? and isn't it unusual for the source command to not be installed?

like image 547
kylemac Avatar asked Mar 16 '10 15:03

kylemac


3 Answers

General thought process:

  • Use ps to confirm you're actually using sh not bash

  • confirm that /bin/bash exists and works properly (and [re]install it if it doesn't)

  • use chsh to change your login shell to bash

  • install the bash-completion package if it's missing

like image 112
Cascabel Avatar answered Nov 07 '22 03:11

Cascabel


You should be getting bash: source: command not found (except that bash will never fail to find source, of course). If you get sh:, then you're either not running bash at all, or running bash with the flag that tells it to pretend it's the Bourne shell /bin/sh. Type bash to get a real bash, or edit the startup configuration so that it doesn't pass that flag for you (not sure where they are in Ubuntu).

like image 1
Kilian Foth Avatar answered Nov 07 '22 04:11

Kilian Foth


Ubuntu servers sometimes have /bin/sh as the default shell. This is consistent with the issue you posted, as /bin/sh does not have the source command available. If you are noticing missing bash features, it might be possible that you aren't in bash. Here are the steps to follow, and something to remember whenever you log on to a new *nix box:

  1. Check which shell you are using with echo $0
  2. See what shells are available with cat /etc/shells
    1. Look for /bin/bash in the list if you want to use bash
    2. If bash is not in the list, apt-get install bash (Ubuntu/Debian specific)
  3. Start using bash with exec /bin/bash
  4. Set bash as your login shell with chsh -s /bin/bash
like image 1
spex Avatar answered Nov 07 '22 03:11

spex