- add details of using /etc/profile.d and how to deal with MacOS X

This commit is contained in:
ianmacd 2003-08-03 16:45:59 +00:00
parent 66f191dfde
commit 7a43833338

32
README
View File

@ -1,12 +1,16 @@
$Id: README,v 1.18 2003/04/21 10:00:03 ianmacd Exp $
$Id: README,v 1.19 2003/08/03 18:45:59 ianmacd Exp $
INSTALLATION
------------
If you are installing the source file manually as opposed to using a
packaging system such as dpkg or rpm, put it somewhere on your system
and source it from either /etc/bashrc or ~/.bashrc.
The easiest way to install this software is to use a package, such as
the RPM that I maintain for Red Hat Linux, the .deb package for
Debian/GNU Linux, etc.
If that's not an option or you simply don't want to do this, put the
bash_completion file somewhere on your system and source it from either
/etc/bashrc or ~/.bashrc.
Here's one possible way of doing that from /etc/bashrc:
@ -26,6 +30,26 @@ using it is that it will also parse correctly when interpreted by bash
1.x. If you have bash 1.x and bash 2.x users on your system, you must
avoid using constructs that were not valid under 1.x syntax.
If your system has an /etc/profile.d directory, you might instead want
to add a script called bash_completion.sh to that directory. Add the
above code, preceded by the following:
# check for bash
[ -z "$BASH_VERSION" ] && return
In this case, all *.sh scripts in /etc/profile.d are sourced from
/etc/bashrc by Bourne-like shells, so you need the extra check for bash
in order to avoid sourcing the rest of the script if a shell other than
bash is running.
If you're using MacOS X, /etc/bashrc is apparently not sourced at all.
In that case, you should put the bash_completion file in /sw/etc and add
the following code to ~/.bash_profile:
if [ -f /sw/etc/bash_completion ]; then
. /sw/etc/bash_completion
fi
If you are putting the bash completion source file somewhere other
than /etc/bash_completion, you should ensure that $BASH_COMPLETION is
set to point to it before you source it. Your ~/.bashrc file is a good