Solved bash completion error

When konsole in kde plasma, freebsd 13-0 release, starts, it starts with this error:
Code:
bash: /usr/local/share/bash-completion/bash-completion.sh: No such file or directory

I search for the file, found it, even tried changing permissions

/usr/local/share/bash-completion]$ ls -l

Code:
total 66
-rw-r--r--  1 root  wheel  76342 May  3 23:48 bash_completion
-rwxr--r-x  1 root  wheel    738 May  3 23:48 bash_completion.sh
drwxr-xr-x  2 root  wheel    766 May 10 01:23 completions
drwxr-xr-x  2 root  wheel      5 May  4 00:44 helpers

This is what I find in the file

Code:
GNU nano 6.2                                                                                                 bash_completion.sh                                                                                                           
# shellcheck shell=sh disable=SC1091,SC2039,SC2166
# Check for interactive bash and that we haven't already been sourced.
if [ "x${BASH_VERSION-}" != x -a "x${PS1-}" != x -a "x${BASH_COMPLETION_VERSINFO-}" = x ]; then

    # Check for recent enough version of bash.
    if [ "${BASH_VERSINFO[0]}" -gt 4 ] ||
        [ "${BASH_VERSINFO[0]}" -eq 4 -a "${BASH_VERSINFO[1]}" -ge 2 ]; then
        [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] &&
            . "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion"
        if shopt -q progcomp && [ -r /usr/local/share/bash-completion/bash_completion ]; then
            # Source completion code.
            . /usr/local/share/bash-completion/bash_completion
        fi
    fi

fi

$ bash -x

Code:
+ [[ -n [\u@\h \w]\$ ]]
+ [[ -f /usr/local/share/bash-completion/bash-completion.sh ]]
+ source /usr/local/share/bash-completion/bash-completion.sh
bash: /usr/local/share/bash-completion/bash-completion.sh: No such file or directory
++ tty
+ export GPG_TTY=/dev/pts/1
+ GPG_TTY=/dev/pts/1

Please tell me what to do to fix the bash_completion error.

Thank you.
 
What's the output of ls -ld /usr/local/share /usr/local/share/bash-completion?

Oh wait. Subtle.

It's /usr/local/share/bash-completion/bash_completion.sh not /usr/local/share/bash-completion/bash-completion.sh. Note the underscore in bash_completion.sh.
 
What's the output of ls -ld /usr/local/share /usr/local/share/bash-completion?

Oh wait. Subtle.

It's /usr/local/share/bash-completion/bash_completion.sh not /usr/local/share/bash-completion/bash-completion.sh. Note the underscore in bash_completion.sh.

This is what it says:

ls -ld /usr/local/share/bash-completion/bash_completion.sh
-rwxr--r-x 1 root wheel 738 May 3 23:48 /usr/local/share/bash-completion/bash_completion.sh

Thank you.
 
Look closely at the bit of script you added to ~/.bashrc.

Thank you SirDice.

Now it looks as follows: (corrected the first line, didn't solve the problem even after reboot, then I looked again and found the error in the second line, corrected it, and after hash -r, launched the console again, there was no error.

[[ $PS1 && -f /usr/local/share/bash-completion/bash_completion.sh ]] source /usr/local/share/bash-completion/bash_completion.sh #gpg key export# export GPG_TTY=$(tty)

Thank you.
 
Thank you SirDice.

Now it looks as follows: (corrected the first line, didn't solve the problem even after reboot, then I looked again and found the error in the second line, corrected it, and after hash -r, launched the console again, there was no error.

[[ $PS1 && -f /usr/local/share/bash-completion/bash_completion.sh ]] source /usr/local/share/bash-completion/bash_completion.sh #gpg key export# export GPG_TTY=$(tty)

Thank you.

Thank you again. Solved. But in the process of trying a fix, I modified the permissions of bash_completion.sh as follows:



-rwxr--r-x 1 root wheel 738 May 3 23:48 bash_completion.sh # u+x o+x g+wx

Aren't these unnecessary or excessive permissions?

Thank you
 
That bash_completion.sh doesn't need execute permissions, the script is sourced not executed.
 
SirDice The problem is back again, for a different reason.

Konsole opens with the error
Code:
bash: /usr/local/share/bash-completion/bash_completion.sh: No such file or directory
readline: ~/.inputrc: line 1: HISTSIZE=10000: no key sequence terminator

nano ~/.bashrc shows
Code:
[[ $PS1 && -f /usr/local/share/bash-completion/bash_completion.sh ]]
source /usr/local/share/bash-completion/bash_completion.sh
#gpg key export#
export GPG_TTY=$(tty)
export HISTSIZE=10000
export HISTFILESIZE=10000

but

ls /usr/local/share/bash-completion doesn't show bash_completion.sh
Code:
completions     helpers
 
It appeared not installed. (Strange, bash history has been working fine, I must have done something between shell changes or something else)
I found the port and installed bash-completion, and the bash-completion error is gone.

Thank you.
 
Back
Top