Bug 1842065 - Make default ~/.bashrc source files in ~/.bashrc.d
Summary: Make default ~/.bashrc source files in ~/.bashrc.d
Keywords:
Status: CLOSED DUPLICATE of bug 1726397
Alias: None
Product: Fedora
Classification: Fedora
Component: bash
Version: 32
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Siteshwar Vashisht
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-05-30 16:03 UTC by Jon Dufresne
Modified: 2020-05-31 23:14 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2020-05-31 23:14:11 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

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 ***


Note You need to log in before you can comment on or make changes to this bug.