core base shell repo including setup scripts. The repo constitues a minimal install
Go to file
David Kebler e25e44a98d added setup directory with set of user and system source files that can be copied in new machine
changed setup.sh to load.sh
startup only loads system repos by default and allows passing directory argument
2020-11-10 14:09:08 -08:00
alias Initial commit of new shell sourcing system - base directory 2020-11-03 12:07:49 -08:00
app added setup directory with set of user and system source files that can be copied in new machine 2020-11-10 14:09:08 -08:00
archive Initial commit of new shell sourcing system - base directory 2020-11-03 12:07:49 -08:00
env added setup directory with set of user and system source files that can be copied in new machine 2020-11-10 14:09:08 -08:00
function added setup directory with set of user and system source files that can be copied in new machine 2020-11-10 14:09:08 -08:00
lang some small fixes to block module 2020-11-07 22:21:27 -08:00
misc added setup directory with set of user and system source files that can be copied in new machine 2020-11-10 14:09:08 -08:00
modules added setup directory with set of user and system source files that can be copied in new machine 2020-11-10 14:09:08 -08:00
setup added setup directory with set of user and system source files that can be copied in new machine 2020-11-10 14:09:08 -08:00
.gitignore added setup directory with set of user and system source files that can be copied in new machine 2020-11-10 14:09:08 -08:00
README.md added setup directory with set of user and system source files that can be copied in new machine 2020-11-10 14:09:08 -08:00
load.sh added setup directory with set of user and system source files that can be copied in new machine 2020-11-10 14:09:08 -08:00
options add modules function to find and load modules 2020-11-06 14:24:10 -08:00
source-dir.func added setup directory with set of user and system source files that can be copied in new machine 2020-11-10 14:09:08 -08:00

README.md

Bash Shell Organizer

A better way to keep your shell setup organized, clean, and useful

interactive (.bashrc) environment, aliases, functions, modules

Install

Clone to a directory

git clone https://git.kebler.net/bashrc <repo path> suggestion: /opt/shell/base

now edit your ~/.bashrc with nano or other available editor

add this

# BASH_SHELL is a common parent directory that should be set in /etc/bash.bashrc
export BASH_SHELL_REPO=<repo path>/setup.
source $BASH_SHELL_REPO/setup.sh

The idea is to keep the .bashrc file completely clean and manage this repo instead so you should really find a home for all the existing content of your .bashrc file within the repo

Every file in env functions,aliases and misc subdirectories will be sourced in that order (in setup.sh). Within each folder all files are sourced except ones ending with a .off extension, starting with . and the README.md file plus any in any subfolder except /archive or /dep

The sourced files in this repo should be NOT be user/machine/network specific

if you include any of these environment variables all files in there directories will be sourced where

unless below specific directories are set

shell files are sourced in this order

sourced via /etc/bash.bashrc so for all machine users

$BASH_SHELL_BASE # this MUST be set in /etc/bash.bashrc

$BASH_SHELL_NETWORK/all

$BASH_SHELL_NETWORK/$NETWORKNAME

$BASH_SHELL_HOST/all

$BASH_SHELL_HOST/

sourced via $HOME/.bashrc

$HOME/shell or $HOME/BASH_SHELL_USER

within each of those directories if setup.sh exits it will be run

otherwise files will be sourced exactly like in the base

identify a network name that this host resides on

like hostname but for the LAN network

if unset then only /all will be sourced

export NETWORKNAME=238

will use $BASH_SHELL_NETWORK/$NETWORKNAME under this directory unless specifically set

export BASH_SHELL_NETWORK=$BASH_SHELL/network

will use $BASH_SHELL_HOST/ unless specifically set

export BASH_SHELL_HOST=$BASH_SHELL/host

by default SHELL sources will be looked for under $HOME/bash/shell

but can be user set below to $HOME/$BASH_SHELL_USER

export BASH_SHELL_USER=<some directory under $HOME>

if there is a script setup.sh in the root of these directoies it will be run. If not then all files no matter how deep will be sourced in alpha order order.

For those

If need to turn off a file just add .off to the file name rather than move or delete the file...simple.

If you are really done with something but want to keep a copy in the repo move it to /archive folder within the primary subfolders

if sourcing some file depends on another preface with numbers to put it before. Functions are all sourced before aliases so can be refered to there.

Be aware that an alias or function set in the repo could be subsuming some existing binary or script.

[[ $BASHPID -eq $$ ]] && echo was called directly || echo was called in a subshell https://unix.stackexchange.com/a/594809/201387