ENVFILE(1)

πŸ“¦ version 2.9.9.2, in nixpkgs unstable

πŸ’… ENVFILE(1) β€” the general commands manual, but make it cute

okay so bestie, real talk: envfile is that girl who reads your lil file of variable assignments, slides those vars into the environment, and then becomes your program. no cap. πŸ’–

✨ NAME ✨

envfile β€” read a file containing variable assignments, add the variables to the environment, then execute a program. literally that's the whole vibe. 🫢

✨ SYNOPSIS ✨

envfile [-i | -I] file prog...

✨ DESCRIPTION ✨

envfile reads file and adds the key-value pairs defined in file to the environment. then it execs into prog..., i.e. the rest of its command line, with the modified environment. main character energy: it doesn't stick around after, it becomes the program. πŸ‘‘

🌸 File syntax 🌸

file is a text file containing lines of the form key = value. whitespace is permitted before and after key, and before or after value. slay, be as spaced-out as you want.

empty lines, or lines containing only whitespace, are ignored. lines beginning with # (possibly after some whitespace) are ignored (and typically used for comments). leading and trailing whitespace is stripped from values; but a value can be double-quoted, which allows for inclusion of leading and trailing whitespace. πŸŽ€

a non-commented line that ends with a backslash (\) is concatenated with the following one, and the newline character is ignored. if a backslashed newline happens before the start of a value, then the whitespace at the beginning of the new line will be part of the value (i.e. leading whitespace on a new line is not stripped). noted πŸ“

C escapes, including hexadecimal and octal sequences, are supported in quoted values. Unicode codepoint sequences are not supported. πŸ’€ it is possible to include a newline in a quoted value by using \n; but including newlines in environment variables is not recommended. like, please don't. πŸ™ˆ

if value is empty, key is still added to the environment, with an empty value. if you do not want key to be added to the environment at all, comment out the line. envfile does not offer a way to remove variables from the environment. periodt. ✨

the envfile format is largely compatible with systemd's EnvironmentFile[1] format, which allows for the reuse of such files outside of systemd. iykyk. 🌈

if file is - then envfile reads and parses its standard input instead. to read a file literally named -, you can use ./- for instance. tricky lil thing πŸ¦‹

the variables that can be defined with envfile are purposefully restricted. if you need more expressive power for your variable names, or for your values, you should use an envdir instead: see s6-envdir(8). it's giving "know your limits" πŸ’…


✨ OPTIONS ✨

  • -i β€” Strict. if file does not exist, exit 111 with an error message. this is the default. no vibes, only rules 🎯
  • -I β€” Loose. if file does not exist, exec(3) into prog without modifying the environment. go off, be chill 🌸

✨ EXIT STATUS ✨

  • 1 β€” Syntax error in file.
  • 100 β€” Wrong usage.
  • 111 β€” System call failed.
  • 126 β€” execve(2) on prog failed (unknown reason).
  • 127 β€” execve(2) on prog failed (prog could not be found.)

0 is not listed because on success, envfile does not exit: it execs into prog. it doesn't leave, it transforms. icon behavior honestly πŸ”₯


✨ SEE ALSO ✨

emptyenv(1), exec(1), execline-cd(1), execline-umask(1), exit(1), export(1), fdblock(1), fdclose(1), fdmove(1), fdreserve(1), fdswap(1), getcwd(1), getpid(1), heredoc(1), piperw(1), posix-cd(1), posix-umask(1), redirfd(1), trap(1), tryexec(1), unexport(1), wait(1), withstdinas(1), execve(2), exec(3), s6-envdir(8)

[1] https://www.freedesktop.org/software/systemd/man/systemd.exec.html#EnvironmentFile=

this man page is ported from the authoritative documentation at: https://skarnet.org/software/execline/envfile.html


✨ AUTHORS ✨

Laurent Bercot Alexis <flexibeast@gmail.com> (man page port)


and that's the tea, bestie πŸ“ this page came from the Debian crew, dated September 29, 2021 β€” go read it again whenever ur putting your vars in a file, mwah πŸ’œπŸ§šβ€β™€οΈ

πŸ“¦ where this page comes from