In this article, I will explain how you can easily share shell scripts between your workstations. Some of these scripts, such as convenient aliases or a git color prompt script, have to be run each time you start your shell; others only have to be accessible from the PATH. Both cases are covered by this trick.
But first, you should read Part 0, if you haven’t done so already.
- Create a folder called
- Create two subfolders:
scriptswill contain the scripts that need to be on the PATH;
sessionwill contain the scripts that have to run each time you open up a terminal.
- Create the
~/Dropbox/config/bash. (Indeed; it shouldn’t be in
session!) Make it executable. Its contents should be as follows:
This file will iterate over all the files in the given directory; in this case,
~/Dropbox/config/bash/session/*, and execute them.
- Finally, create a file called
~/Dropbox/config/bash/sessionfolder. Again, don’t forget to make it executable. It should contain the following one-liner:
… which is how
~/Dropbox/config/bash/scripts/ ends up on the PATH.
Per computer set-up
On each computer, you need to add the following line to the end of your
~/.bashrc to make it all work:
Don’t forget the dot! It won’t work without it. And that’s all!