bash_setup is a small framework for setting up a consistent Bash environment across Linux and macOS. It:
- Creates/validates a standard directory layout under
$HOME - Backs up and installs curated dotfiles (bashrc, inputrc, tmux.conf, etc.)
- Exposes menu-driven tasks to install/undo the dotfiles and perform setup
- Integrates CI (ShellCheck), formatting (shfmt), and basic tests (BATS)
- Entry point:
./SetupBash.sh - Configuration: sources
config/config.sh(paths, dirs, logging) andconfig/lists.sh(dotfile lists & menu items) - Core library: sources
lib/common_core/lib/utils.shandlib/common_core/lib/menu.sh(logging, prompts, menu loop) - Tasks: sources
menu/menu_tasks.sh(e.g.,Setup_Dot_Files,Undo_Setup_Dot_Files,Setup_Bash_Directories) - Dotfiles: copies files from
./dotfiles/into the right places, backing up any existing ones
Note: This repo expects a
lib/common_coresubmodule that provides shared functions such as logging, error handling, prompts, and menu helpers.
. ├── SetupBash.sh # main entrypoint script ├── config/ │ ├── config.sh # environment variables, dirs (DATA/, LOGS/, etc.) │ └── lists.sh # arrays of dotfiles and menu items ├── dotfiles/ # bash/tmux/screen/vim/wget/curl configs & alias files ├── lib/ │ └── common_core/ # (git submodule) expected to contain lib/utils.sh, lib/menu.sh ├── menu/ │ └── menu_tasks.sh # functions: Setup_Dot_Files, Undo_Setup_Dot_Files, Setup_Bash_Directories ├── tests/ │ └── ... # BATS sanity tests ├── Makefile # helper targets (lint/format/test/install/run/etc.) └── README.md - Bash ≥ 4.0 (Linux default; on macOS you may need to install via Homebrew)
- git (for submodules)
- Recommended for development:
- ShellCheck (lint)
- shfmt (format)
- BATS (tests)
macOS users can install these via Homebrew; Linux users via apt/yum/pacman as appropriate.
# 1) Clone the repo git clone https://github.com/tatanus/bash_setup.git cd bash_setup # 2) Fetch the core submodule(s) git submodule update --init --recursive # 3) (Dev) Install tools (examples) # macOS: brew install shellcheck shfmt bats-core # Ubuntu: sudo apt-get update && sudo apt-get install -y shellcheck shfmt bats # 4) Run lint/format/tests (optional, recommended) make lint make fmt make test # 5) Run the setup ./SetupBash.shFrom config/lists.sh, the default dotfiles include (not exhaustive):
dotfiles/bashrc,dotfiles/bash_profile,dotfiles/profiledotfiles/inputrcdotfiles/tmux.confandtmux.aliases.shdotfiles/screenrc_v4,screenrc_v5,screen.aliases.shdotfiles/vimrcdotfiles/curlrc,dotfiles/wgetrc- Various
*.aliases.sh,bash.*.shhelpers (env, funcs, path, prompt, visuals, ssh, tgt, etc.)
You can tailor the installation list by editing config/lists.sh arrays.
From menu/menu_tasks.sh:
Setup_Dot_Files— Back up existing user dotfiles and replace with repo versionsUndo_Setup_Dot_Files— Restore backups and remove installed dotfilesSetup_Bash_Directories— Create expected directories (e.g.,${HOME}/DATA,${HOME}/DATA/LOGS)
These are typically surfaced through a menu (provided by lib/common_core/lib/menu.sh) that the entrypoint script calls.
config/config.sh:
- Establishes
${HOME}assumptions & derived dirs:${DATA_DIR}="${HOME}/DATA"${LOGS_DIR}="${DATA_DIR}/LOGS"${BASH_DIR}/${BASH_LOG_FILE}and other script-internal paths
- Central place to enable/disable logging to file, tweak defaults, etc.
config/lists.sh:
- The lists of dotfiles to install
- The list of menu items to expose
Common commands:
# lint bash files with ShellCheck make lint # format with shfmt make fmt # run tests (BATS) make test-
Missing functions like
info/pass/warn/fail
→ These come fromlib/common_core/lib/utils.sh. Confirm the submodule is present and sourced. -
macOS
getentnot found
→ The entrypoint has a fallback for resolving$HOME, but prefer cross-platform checks. Verifywhoami,$HOME, anddscl/idas needed. -
Dotfiles not installed
→ Checkconfig/lists.shis sourced and arrays are populated; runSetup_Bash_Directoriesfirst; verify write permissions in$HOME.
Contributions are welcome! Please follow these steps:
- Fork this repository.
- Create a branch for your feature or fix.
- Commit your changes and push to your fork.
- Submit a pull request.
This project is licensed under the MIT License.
For any questions, feature requests, or bug reports, feel free to open an issue or contact the repository owner.