Bug 1842065

Summary: Make default ~/.bashrc source files in ~/.bashrc.d
Product: [Fedora] Fedora Reporter: Jon Dufresne <jon.dufresne>
Component: bashAssignee: Siteshwar Vashisht <svashisht>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 32CC: admiller, kasal, kdudka, ssbarnea, svashisht
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-31 23:14:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jon Dufresne 2020-05-30 16:03:09 UTC
I automate my environment across multiple workstations using Ansible. Part of
this automation requires editing ~/.bashrc.

Editing ~/.bashrc is often messy as the file doesn't have a strict structure.
Long customization blocks often require care when parsed by automation tools.

Suggestion:

Follow the pattern used by other projects and allow for customizations to live
in their own file in a specified directory: i.e. ~/.bashrc.d. The file
/etc/profile already takes a similar approach.

The following could be added to the default ~/.bashrc to make this work:

# Avoid editing ~/.bashrc directly. Instead add files in ~/.bashrc.d/*.sh to
# make custom changes to your environment.
for f in $(compgen -G "${HOME}/.bashrc.d/*.sh"); do
    . "${f}"
done

Here is an article that describes this approach:
https://medium.com/@waxzce/use-bashrc-d-directory-instead-of-bloated-bashrc-50204d5389ff

Comment 1 Kamil Dudka 2020-05-31 21:24:00 UTC
Is this a duplicate of bug #1726397 ?

Comment 2 Jon Dufresne 2020-05-31 23:14:11 UTC
Yup! Thanks for finding that. I missed it during my searching.

*** This bug has been marked as a duplicate of bug 1726397 ***