[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Command Line Completion for Programs?



Kirchner, Patrick wrote:

Now I just have to figure out why the /etc/bash.bashrc wasn't being
processed.  Perhaps it's due to the presence of the .bashrc in my home
directory?
I had a similar problem and I couldn't look into right away so I too the lazy man's approach and just renamed /etc/bash.bashrc to /etc/bashrc, thinking that bash would use it for system-wide defaults automatically. Wrong... Looks like bash doesn't work this way and only knows the global file /etc/profile and that only gets executed when you log in. In other words bash knows about ~/.bashrc but knows nothing about /etc/bashrc (or in Debian /etc.bash/bashrc).

So, if you want/need a global (system-wide) rc file to be executed for each shell/subshell you need to code something like this in your ~/.bashrc:

if [ -f /etc/bash.bashrc ]; then
   . /etc/bash.bashrc
fi

Frankly, I've spent valuable time adding "echo executing .bashrc".. "echo in /etc/bashrc" etc. to all these files and never could come up with a clear-cut strategy as to what gets executed, when.. and what should go into which of those files.

Note that if you need clarification of the stuff in the bash man page and if you can afford to spend the time and effort the folks at the bash mailing list are very helpful and knowledgeable enough to give accurate answers to all the finer points.

Cheers,
Chris.
Thanks again,

Patrick.


-----Original Message-----
From: debian-user-request@lists.debian.org
[mailto:debian-user-request@lists.debian.org] On Behalf Of Jon Dowland
Sent: Thursday, January 13, 2005 1:58 PM
To: Debian User List
Subject: Re: Command Line Completion for Programs?


On Thu, 13 Jan 2005 07:35:42 -0800, Kirchner, Patrick
<Patrick.Kirchner@earthtech.com> wrote:
# enable bash completion in interactive shells
if [ -f /etc/bash_completion ]; then
   . /etc/bash_completion
fi

If someone could assist me I would be most appreciative.

It sounds like a sourcing issue. Stick some exports in /etc/bash.bashrc and
/etc/bash_completion, like

export BASH_DOT_BASHRC_WAS_SOURCED
export BASH_COMPLETION_WAS_SOURCED

or similar, and see if they are set for your terminal. If not, you need to
read up on when various dot files are sourced.





Reply to: