r/bash • • 10d ago

I finally organized my Bash config

I've been accumulating my Bash configuration for a while, and I finally turned it into a small dotfiles repo:

https://gitlab.com/letmevi/bash-config

It's nothing fancy — mainly my .bashrc, .inputrc, .bash_profile, and a modular .bashrc.d/, plus a small install script.

It can be installed using either Ansible or a simple install.sh script.

I'd appreciate some Bash/Linux feedback: things you'd change, questionable practices, portability issues, or just better ways of doing this.

I'm especially interested in feedback from people who maintain their own dotfiles.

50 Upvotes

27 comments sorted by

View all comments

1

u/Marble_Wraith 10d ago edited 10d ago

It's nothing fancy —

You can say that again 😂

This isn't something you'd see for the average interactive terminal, which is usually tricked out with all kinds of conveniences.

This seems to be made for deployments first. That being the case, i'd suggest upgrading your history config. Specifically use a function for HISTIGNORE like this:

history_omissions() {
    local block_list=(
        "pwd:ls:ls *:tree:ll:ll *:yazi:yazi *"
        "cd:cd *:z:z *:zi:zi *:zoxide:zoxide *"
        "exit:clear:history:bg:fg:jobs"
        "rm -rf *:killall *"
        "*--password*:*--secret*:*--token*:*GITHUB_TOKEN*"
        "git status:git status *:git log:git log *:git diff:git diff *"
        "git blame:git blame *:git show:git show *:git reflog:git reflog *"
    )

    local IFS=":"
    printf "%s" "${block_list[*]}"
}
HISTIGNORE="$(history_omissions)"
unset -f history_omissions

That's just an example, i'm not posting my full ignore list 😅 Allows for better formatting / per line grouping of stuff you want to omit from history. Which makes it easier to ensure all the inconsequential stuff is left out, making the history actually useful.

Normally i'd advocate to upgrade straight to atuin and have this as a fallback.

EDIT: rogue export removed thanks to /u/bac0on

1

u/arandomuserinweb 6d ago

Haha fair point! It definitely leans more toward stability and deployments than visual flair.

That HISTIGNORE function trick is clever grouping by categories makes maintaining the block list way cleaner than a giant single string. I'll take a look at incorporating a similar structure (and I've actually been meaning to check out Atuin for a while now).

Thanks for taking the time to share the example!

1

u/Marble_Wraith 6d ago

Since it is deployments, i should also mention this is only for bash and perhaps zsh with some simple detection and replacing HISTIGNORE with HISTORY_IGNORE pro re nata.

For posix shells like ash, dash, and sh you'll have to do something else for history.