envdir(8)

πŸ“¦
version 0.76 Β· 2 versions
  • 0.76 Β· debian bookworm, debian trixie, nixpkgs unstable, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 1.11 Β· alpine 3.24
, in debian bookworm, debian trixie, nixpkgs unstable, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– envdir(8) β€” bestie edition πŸ’–

okay so this is envdir, from the System Manager's Manual, and it's literally one of those tiny tools that does one thing and does it flawlessly ✨


✨ NAME ✨

envdir β€” runs another program with environment modified according to files in a specified directory.

like. it runs your program. but the environment? customized. by files. in a directory. we love a filesystem-as-config moment πŸŽ€


🌸 SYNOPSIS 🌸

envdir d child

πŸ’… DESCRIPTION πŸ’…

okay bestie, sit down, this is so simple you're gonna scream 🫢

d is a single argument. child consists of one or more arguments.

envdir sets various environment variables as specified by files in the directory named d. It then runs child. that's it. that's the whole vibe. directory of files β†’ environment variables β†’ your program πŸ¦‹

here's the tea on how it actually works:

If d contains a file named s whose first line is t, envdir removes an environment variable named s if one exists, and then adds an environment variable named s with value t. so it's not "merge" β€” it's yeet the old one, drop in the new one πŸ’€

and bestie, the name s must not contain =. that's the rule. don't fight it.

Spaces and tabs at the end of t are removed. Nulls in t are changed to newlines in the environment variable. (yes, that's a whole little transformation pipeline, it's giving glow-up for your bytes ✨)

and then the special case, because there's always a special case:

If the file s is completely empty (0 bytes long), envdir removes an environment variable named s if one exists, without adding a new variable. so an empty file is an unset, not an empty string. no cap. πŸ™ˆ


πŸ‘‘ EXIT CODES πŸ‘‘

envdir exits 111 if it has trouble reading d, if it runs out of memory for environment variables, or if it cannot run child.

Otherwise its exit code is the same as that of child.

so like, 111 = envdir itself is having a moment 😭 and literally anything else = that's just your program's business, envdir is only the messenger πŸ’Œ

🌈 SEE ALSO 🌈

the whole friend group, they all hang out together:

and the mothership itself: http://cr.yp.to/daemontools.html 🌐


okay that's the whole page bestie πŸ’– this was envdir(8) from the System Manager's Manual, brought to you by the daemontools crew (yes, that cr.yp.to link up there is the source of the whole saga, go say hi πŸ‘‘). go set some environment variables. slay. periodt. βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from