#988476 bash: use /etc/profile.d/bash_completion.sh in scripts

Package:
bash
Source:
bash
Description:
GNU Bourne Again SHell
Submitter:
Christoph Anton Mitterer
Date:
2021-05-13 18:45:03 UTC
Severity:
wishlist
#988476#5
Date:
2021-05-13 18:36:07 UTC
From:
To:
Hey there.

Currently, /etc/bash.bashrc (where it's commented though) and /etc/skel/.bashrc
use the following to enable bash-completion:

It would be nice, if instead of this, something like the following could be used.

That file is shipped by bash-completion, so when the original code would work,
it's also guaranteed to be there.


It also does some checks like whether the shell is interactive, whether
bash-completion has already been sourced and so on.

Plus it's what any login shell does, where that file is sourced already - at least
with Debian's default /etc/profile.
And I think it's a good idea, if it's guaranteed when the two do the same.


btw: It *is* still necessary to source the file from within .bashrc, cause
/etc/profile isn't sourced on non-login shells (i.e. terminal launched from a
desktop environment)



Cheers,
Chris.

#988476#10
Date:
2021-05-13 18:41:15 UTC
From:
To:
Oh and btw:

Maybe it's time to generally enable bash-completion per default (i.e.
system-wide in /etc/bash.bashrc)?

/etc/profile.d/bash_completion.sh provides a nice way for anyone who
doesn't want completions to disable it, quoting from the README: