-
-
Save YourFriendCaspian/8c83cdc155a28521829c7603e5b3daf9 to your computer and use it in GitHub Desktop.
[.bashrc.d] Use bashrc directory instead of bashrc #bash #bashrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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);” |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added ## Suggestions from comments ## section.