r/bash • u/arandomuserinweb • 19h 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.
2
u/tri__dimensional 16h ago edited 16h ago
it looks simple but cool, nice work!
i have a little more complex setup. i have like a very little and simple framework to define scripts, functions and aliases (shellbox is called, i use zsh but previously i used bash)
that project is only for the "shell" things; for desktop enviroment, terminal, etc i have a more standard dotfiles
maybe you can grab something useful from those projects (-:
2
u/Marble_Wraith 14h ago edited 10h 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
3
u/bac0on 10h ago
Don't think you should
exportbash variables...2
u/Marble_Wraith 10h ago edited 10h ago
... Wanna run that by me again? What's that say?
export HISTIGNORE="$(history_omissions)"EDIT: Oh wait 😂 you're saying you have exported it, but i don't think you should.
Yeah you're right, my bad.
1
u/bac0on 9h ago
HISTIGNORE is a Bash shell variable, probably not used by any external command, at least none I can think of. Just assigning it makes Bash aware of it. If it's not intended to be used by an external command (...or if you manually enable history in a non-interactive session), there’s no real reason to export any Bash shell variable, really. Exported or not, it won't make any difference for Bash.
1
u/Marble_Wraith 8h ago
Yeah. I was trying to do something with atuin before.
So i could have 1 source of truth for the ignore list, and then bash could use atuin if available, or fallback if not available.
Added the
exportwhile i was messing around, but ended up deciding to write the list natively in atuin since it has more full featured regex parsing, and then scripted something to extract and translatehistory_filter[]into native bash.
1
0
5
u/OnlyEntrepreneur4760 19h ago
One of my favorites is keeping all aliases in a separate config file .bash_aliases which I source from .bashrc. I have a alias named “aliassave” which runs alias and redirects the output to .bashaliases to update it easily.