Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically enabling bash completion on Fedora 28

Tags:

bash

fedora

I have a Fedora 28 installation on which I have installed the bash bash-completion package.

I have run the following:

source /etc/profile.d/bash_completion.sh

And bash completion works as expected.

However, whenever I re-login, I must run the above command before bash completion starts working - it is not enabled automatically.

I have checked the permissions of the bash_completion.sh file and even added the x flag, but it is still not enabled automatically.

How can I get this working?

like image 598
Daniel Scott Avatar asked Apr 07 '26 16:04

Daniel Scott


1 Answers

The /etc/bashrc file provided by the setup package, will source all scripts in /etc/profile.d/ by default. Also, by default your ~/.bashrc, should have the following (you can verify it's the default by looking in /etc/skel/.bashrc) :

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

Here's the relevant part (towards the end) of that file that I see on my system (Fedora 28 Workstation):

for i in /etc/profile.d/*.sh; do
    if [ -r "$i" ]; then
        if [ "$PS1" ]; then
            . "$i"
        else
            . "$i" >/dev/null
        fi
    fi
done

Here's the version of setup that I'm using (and proof that that's where it comes from):

$ rpm -q --whatprovides /etc/bashrc 
setup-2.11.4-1.fc28.noarch
like image 103
grdryn Avatar answered Apr 10 '26 12:04

grdryn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!