Skip to content

Instantly share code, notes, and snippets.

@573
Created October 17, 2012 19:10
Show Gist options
  • Save 573/3907478 to your computer and use it in GitHub Desktop.
Save 573/3907478 to your computer and use it in GitHub Desktop.
~/.bashrc file for using *.bashrc files inside a ~/.bashrc.d folder to load different stuff for a shell session - environment etc.
# To pick up the latest recommended .bashrc content,
# look in /etc/defaults/etc/skel/.bashrc
# Modifying /etc/skel/.bashrc directly will prevent
# setup from updating it.
# The copy in your home directory (~/.bashrc) is yours, please
# feel free to customise it to create a shell
# environment to your liking. If you feel a change
# would be benificial to all, please feel free to send
# a patch to the cygwin mailing list.
# User dependent .bashrc file
# ...
if [ -d ~/.bashrc.d ]; then
for file in $(/bin/ls ~/.bashrc.d/*.bashrc); do
. $file;
done
fi
@jwilson8767
Copy link

Here's the same result in one line: source <(cat ~/.bashrc.d/*.bashrc 2>/dev/null)
To setup the directory use mkdir ~/.bashrc.d && chmod 744 ~/.bashrc.d

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