hello friends,
I am looking for a way to do what I described in the title. When running command command, I dont want to have to type SOME_ENV_VAR=value command every time, especially if there are multiple.
I am sure youre immediately thinking aliases. My issue with aliases is that if I do this for several programs, my .bashrc will get large and messy quickly. I would prefer a way to separate those by program or application, rather than put them all in one file.
Is there a clean way to do this?


If you were using Zsh, one way you could do this is by autoloading function files from a folder in your
fpath.Let’s say you’re using
~/.local/share/zsh/site-functionsfor your custom functions. To ensure that folder is an early part of yourfpath, put something like this within your.zshrc:typeset -U fpath=(~/.local/share/zsh/site-functions $fpath)Then let’s say you want to override the
uptimecommand. Add a file~/.local/share/zsh/site-functions/uptimewith content like:NO_COLOR=1 =uptimeExplanation for the second
=:The last thing you need to do is mark it for autoloading, in your
.zshrc:autoload -Uz uptimeInstead of listing those functions manually as arguments, you could instead use a glob pattern to collect all those names, excluding any which begin with
_(completion functions):autoload -Uz ~/.local/share/zsh/site-functions/[^_]*(:t)