Like awsudo
but for any set of env vars.
Download binary for your system from the latest release; put it somewhere on your path.
Create a file ~/.envdo.toml
; it should contain data in the following format:
[profile_name] # profile names should not nest; default profile is called `default`
# Env var names should be upper case with underscores
ENV_VAR_NAME = "value" # values should be TOML strings; no other data type is allowed
envdo -p <profile_name> <cmd with args>
# run "env" with profile "foo"
envdo -p foo env
# run "./secret_script.py" and some arguments with implicit profile "default"
envdo ./secret_script.py --yes -R
# run a script under "sh" with profile "foo"
envdo -p foo sh -c 'echo $FOO'
I realized that another tool called envdo
exists. It follows a different
philosophy: instead of being a per-command switcher like sudo
, antonlindstrom
's envdo
is more like su
in that it
switches env var profiles for a session and makes them sticky.
For completeness' sake, there is also direnv
.