Home

Awesome

What is Base?

                Great things are done by a series of small things brought together.
                                                                 - Vincent van Gogh

Base is a sharing platform for shell settings, libraries, and light-weight tools. It gives a structured way for Bash users to organize the following across multiple hosts:

It can benefit anyone who engages with Mac/Linux command line to get their work done.

Requirements

Base needs Bash version 4.2 or above.

How can I get set up?

Set up is easy. Essentially, this is what you have to do:

Log out and log back in or just do exec bash and you are all set!

Here is an example:

cd $HOME
mkdir git && cd git
git clone git@github.com:codeforester/base.git
cd $HOME
mv .bash_profile .bash_profile.safe && ln -sf $HOME/base/lib/bash_profile .bash_profile
mv .bashrc       .bashrc.safe       && ln -sf $HOME/base/lib/bashrc       .bashrc
cp $USER.sh $HOME/base/user
cd $HOME/base
git add user/$USER.sh
git commit -m "Adding the initial version of $USER.sh"
git push

If you don't want to disturb your .bash_profile and .bashrc, you can still use Base in a less full-fledged manner. See the FAQ section for details.

How does Base work?

In a typical setting, .bashrc sources in $BASE_HOME/base_init.sh which does the following:

Directory structure

Screenshot of directory structure

Environment variables

Functions exported by base_init.sh

FAQ

My git location is not $HOME/base. What should I do?

You can either

You need to do this on every host where you want Base.

I want to keep my personal settings private, and not in git. What should I do?

You would need to manage this file outside of Base.

I do want to use the default settings. What should I do?

Add this to your user/$USER.sh file:

import lib/base_defaults.sh

I want to make sure I keep my Base repository updated always. How can I do it?

Add this to your user/$USER.sh file:

base_update

I don't want to reorganize my .bash_profile or .bashrc. Can I still use Base?

Yes, you can, though you will lose the flexibility of keeping your .bash_profile and .bashrc synced across hosts in case you are working with multiple hosts.

To turn on Base upon login, add this to your .bash_profile:

export BASE_HOME=/path/to/base
source "$BASE_HOME/base_init.sh"

after making sure you have the base repo checked out under $BASE_HOME directory.

If you don't want to change your .bash_profile at all, you can still turn Base on and off as needed. First, make sure BASE_HOME is set appropriately, ideally in your .bash_profile.

Run this command to get a shell with Base turned on:

$BASE_HOME/base.sh shell

or $BASE_HOME/base.sh

Debugging