Skip to content

Instantly share code, notes, and snippets.

@YourFriendCaspian
Forked from rot26/.bashrc
Last active May 1, 2023 10:36
Show Gist options
  • Save YourFriendCaspian/8c83cdc155a28521829c7603e5b3daf9 to your computer and use it in GitHub Desktop.
Save YourFriendCaspian/8c83cdc155a28521829c7603e5b3daf9 to your computer and use it in GitHub Desktop.
[.bashrc.d] Use bashrc directory instead of bashrc #bash #bashrc
# Add this to your ~/.bashrc file
# Use .bashrc.d directory instead of bloated .bashrc file
# From: https://waxzce.medium.com/use-bashrc-d-directory-instead-of-bloated-bashrc-50204d5389ff
BASHRC_DIR="${HOME}/.bashrc.d"
# Optionally create directory if not exists
if [ ! -d "${BASHRC_DIR}" ]; then
mkdir -p "${BASHRC_DIR}";
chmod 700 "${BASHRC_DIR}";
fi
# Load any *.bashrc files in ~/.bashrc.d/
if [ -d "${BASHRC_DIR}" ]; then
for file in ${BASHRC_DIR}/*.bashrc; do
source "${file}";
done
fi
## Suggestions from comments ##
mkdir -m 0755 ~/.bashrc.d” and “for file in $(ls ~/.bashrc.d/*.bashrc);
@YourFriendCaspian
Copy link
Author

Added ## Suggestions from comments ## section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment