ENVFILE(1)
π 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, exit111with an error message. this is the default. no vibes, only rules π―-Iβ Loose. if file does not exist,exec(3)intoprogwithout modifying the environment. go off, be chill πΈ
β¨ EXIT STATUS β¨
1β Syntax error in file.100β Wrong usage.111β System call failed.126βexecve(2)onprogfailed (unknown reason).127βexecve(2)onprogfailed (progcould 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
- nixpkgs unstable: execline 2.9.9.2
- nixpkgs unstable: execline-man-pages 2.9.9.1.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms