Caution
This repository is no longer maintained. Feel free to fork this repository or use parts of it in your own shell rc. Below is the original README for reference.
This is my personal Bash and ZSH rc. It is currently used on different Linux flavors (mainly Fedora, Debian and Gentoo) and on Mac OS X. It might work on other platforms. If you encounter any problems on your platform, feel free to contact me. Of course patches to make the code more portable are very welcome.
You can install this bashrc either for one user or system wide, so that it will be used by every user on the system.
In addition to the manual installation and update procedure, there also exists an automatic installer and updater. This currently only works if the bashrc is installed for one user.
To install it system wide you have to place the code somewhere (for example
/usr/local/share/r9e-bashrc
):
mkdir -p /usr/local/share
git clone 'git://github.com/rioderelfte/r9e-bashrc.git' /usr/local/share/r9e-bashrc
Then you have to make sure the src/init.sh
file (e.g.
/usr/local/share/r9e-bashrc/src/init.sh
) gets sourced during the shell start
up. On Linux this can be achieved by creating a symbolic link in
/etc/profile.d/
:
ln -s /usr/local/share/r9e-bashrc/src/init.sh /etc/profile.d/r9e-bashrc.sh
Since all these changes are system wide of course all of the above commands have to be run as root.
To install the bashrc for one user the code has to be placed somewhere, too
(e.g. ~/r9e-bashrc
):
git clone 'git://github.com/rioderelfte/r9e-bashrc.git' ~/r9e-bashrc
Then you need to make sure src/init.sh
gets sourced. For Bash you either can
source it from your ~/.bashrc
or you can just link it:
rm .bashrc
ln -s r9e-bashrc/src/init.sh ~/.bashrc
For the ZSH you can source or link it from your ~/.zshrc
:
rm .zshrc
ln -s r9e-bashrc/src/init.sh ~/.zshrc
Since bash only reads ~/.bashrc
if it is invoked as an interactive shell that
is no login shell (see the
reference manual
for details), your ~/.bash_profile
(or ~/.profile
) should source the
~/.bashrc
. Most Linux distributions automatically install an appropriate
~/.bash_profile
(or ~/.profile
on Debian) if you create a new user. If your
~/.bash_profile
does not source the bashrc, simply insert something like the
following into this file:
if [ -f "${HOME}/.bashrc" ]; then
source "${HOME}/.bashrc"
fi
To automatically install this bashrc for one user, a convenience script
install.sh
is provided in this repository. You can execute it by simply
running:
curl 'https://raw.githubusercontent.com/rioderelfte/r9e-bashrc/master/install.sh' | sh
The script clones this repository to ~/.r9e/bashrc
and installs ~/.bashrc
and ~/.zshrc
files which will source ~/.r9e/bashrc/src/init.sh
. If you
already had a ~/.bashrc
or ~/.zshrc
it will be renamed to
~/.bashrc.pre-r9e
or ~/zshrc.pre-r9e
respectively. But please see the
script itself if you want more details.
The automatic installer does not ensure your ~/.bash_profile
sources the
bashrc. See the section .bashrc and .bash_profile
above for details.
After installing the bashrc this way you will also have an automatic
updater. Simply running r9e_bashrc_update
will pull the git repository and
source the newly fetched bashrc. You will also get a gentle reminder every time
you start a new bash if you did not run the updater for at least one week.
During start up, the bashrc will source several files which can be customized by
the user. Apart from the normal bash customization (like shopt
, alias
and so
on) also some of the functions from this bashrc (for example the prompting) can
be customized, but I won't go into much detail about this.
Additionally the bashrc supports few options, which have to be set before
sourcing the bashrc. For a list of those you can see the ~/.bashrc
file
generated by the install.sh
script. But probably you don't have to change any
of these.
The following files are currently sourced during the bashrc start up:
/etc/r9e-bashrc.sh
~/.bashrc.local
~/.bash_aliases
Also every file with the file extension .sh
from the following directories is
sourced:
/etc/r9e-bashrc.d
~/.bashrc.d
If these directories contain subdirectories (or symbolic links to directories)
named *.d
, files from these directories will be sourced recursively.