Completion gone after bash --norc

From FVue
Jump to: navigation, search

Problem

After I start a subshell with bash --norc, completion doesn't work anymore.

The command complete -p in the parent shell shows me a list of completions, whereas complete -p in the subshell (started via bash --norc) shows me an empty list.

Solution

Completion is not supposed to be exported to a subshell automatically. I was fooled because SuSE's bash – unexpectedly – automatically executes /etc/bash.bashrc upon invocation of an interactive shell.

See also

What happens when you invoke bash?

Journal

20060425

Things seem to happen because bash silently executes /etc/bash.bashrc? Why isn't this mentioned in info bash?

From this SuSE 9.3 page it looks like bash is compiled to look to /etc/bash.bashrc?

Debian seems to have the same feature: Google Groups: gnu.bash: reading /etc/profile on graphical terminals.

freddy@linux:~> bash --version
GNU bash, version 3.00.16(1)-release (i586-suse-linux)
Copyright (C) 2004 Free Software Foundation, Inc.

From this page (lpi-discuss)Bash question: it appears one is invited to comment out lines in bash source code which enable /etc/bash.bashrc as a "System-wide .bashrc file for interactive shells".

Download bash sources

20060426

rpm -i bash-3.0-17.src.rpm
cd /usr/src/packages/SOURCES

There is a file bash-3.0.dif which contains, among others:

...
--- config-top.h
+++ config-top.h        Mon Oct 11 13:02:26 2004
...
 /* System-wide .bashrc file for interactive shells. */
-/* #define SYS_BASHRC "/etc/bash.bashrc" */
+#define SYS_BASHRC "/etc/bash.bashrc"
...

Comments

blog comments powered by Disqus