dotfiles

Obligatory dotfiles repo
git clone git://git.danielmoch.com/dotfiles.git
Log | Files | Refs

commit 700781fd5ed79e486eb2392d36d0816ba6f4ba28
parent 563bfe9ccd0694e3c6c83bfd331245fb67c08b7a
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Tue, 26 Dec 2017 07:34:51 -0500

Bashrc: bash_completion sourcing

Different systems put bash_completion in different places, and some will
source the file from /etc/profile if it exists, so we need a way to
configure this.

If needed, define $BASH_COMPLETION in .bashrc.local to contain the path
to bash_completion. .bashrc will look for the variable and, if the
location it points to is readable, will source it. Note that
$BASH_COMPLETION is removed from the environment after sourcing as it is
presumably not needed anymore.

Diffstat:
M.bashrc | 11+++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/.bashrc b/.bashrc @@ -79,10 +79,17 @@ then fi fi -if [[ -f /usr/share/bash_completion/bash_completion ]] +# $BASH_COMPLETION should contain the path to the bash_completion +# script. If the variable is defined and is readable, it will be +# sourced. +# +# NOTE: Might want to check that this isn't already sourced elsewhere +# (e.g. /etc/profile). +if [[ -n "$BASH_COMPLETION" ]] && [[ -r $BASH_COMPLETION ]] then - source /usr/share/bash_completion/bash_completion + source $BASH_COMPLETION fi +unset BASH_COMPLETION # Handy Tmux aliases if command -v tmux > /dev/null 2>&1