My bashrc tools/tricks
| archive | ||
| data | ||
| hostname | ||
| logos | ||
| .gitignore | ||
| 0-builder | ||
| 2-loader | ||
| aliases.sh | ||
| bash_secrets.sh | ||
| functions.sh | ||
| is_remote.sh | ||
| LICENSE | ||
| misc.sh | ||
| path_enviornment.sh | ||
| README.md | ||
| reboot_msg.sh | ||
| toolchains.sh | ||
| tty-colors.sh | ||
| user-completion.sh | ||
| zz_editor.sh | ||
Bashrc.d
Setup Instructions
- Cleanup your default
.bashrc. Inspect the contents of .bashrc, and ensure it does not attempt to source~/.bashrc.d. If it does (as in the case of RHEL) explicitly comment out or remove those lines. - Clone this repo:
git clone https://git.lil-bird.xyz/siriusfox/bashrc.d.git ~/.bashrc.d - Bootstrap the repo by running the "builder" script:
bash ~/.bashrc.d/0-builder. This will create1-compiledwithin the project as a single-file bashrc. - Test the script:
source ~/.bashrc.d/1-compiled - If it works, append the contents of
2-loaderto your ~/.bashrc to automatically load1-compiledwhen present.
What is this?
This is a simple pure-bash project written to satsify three major objectives:
- Collect and segment all of the .bashrc stuff I use in a portable and reusable way across computers.
- Consolidate all of that stuff into a single file to speed up the startup time of new shells.
- Add per-hostname specific modifications in a way that automatically maintains unique features without having to branch to maintain differences between machines.
The project is largely implemented by the 0-builder script inside this project. The general flow is as follows:
- Builder attempts to find a file named
<hostname>.meta.shinside thehostname/directory. If present, it runs a function within that script called__builder_prebuildto do anything you want. - Builder finds any file in the root of the project with an extension of
.sh, and concatinates the files into a monolitic file called1-compiled. - Builder runs a
__builder_postbuildscript when present from<hostname>.meta.sh - Builder stops.
This will result in a single file with all of the contents of the various *.sh scripts in a single file called 1-compiled, and by adding a pithy file called 2-loader to your main ~/.bashrc, your normal shell will chainload to include all of the contents.
Tips
The script also exposes a pair of functions to speed up testing configuration changes:
__rebuild_bashrcdwill run the builder script, but will not source the changes.