On 01/09/2019 08:03 PM, hykwok1--- via blfs-dev wrote:
I created a new Linux system and followed the instruction (from the "The Bash Shell 
Startup Files" section) to create the file /etc/profile.d/bash_completion.sh. 
However, I got the following errors after system statup:
-bash: have: command not found

After that I found the cause and the solution from the following links:

https://unix.stackexchange.com/questions/286022/have-command-not-found
https://stackoverflow.com/questions/12874920/have-keyword-for-bash-completion

So, I think it is better to update the "The Bash Shell Startup Files"" section 
to mention this issue.

Thanks for the report. I'm not a big fan of completions. Generally I find they get in the way when you want to complete a file name.

That said, I suppose we could add:

cat > /usr/share/bash-completion/bash_completion << "EOF"

# This function checks whether we have a given program on the system.

_have()
{
  # Completions for system administrator commands are installed as well
  # in case completion is attempted via `sudo command ...'.
  PATH=$PATH:/usr/sbin:/sbin:/usr/local/sbin type $1 &>/dev/null
}

# Backwards compatibility for compat completions that use have().
# @deprecated should no longer be used; generally not needed with
# dynamically loaded completions, and _have is suitable for runtime use.

have()
{
   unset -v have
   _have $1 && have=yes
}
EOF

The only thing I can find that uses 'have' is grub. It would be easier to rm /usr/share/bash-completion/completions/grub

  -- Bruce
--
http://lists.linuxfromscratch.org/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to