execline
Software
skarnet.org

The envfile program

envfile reads a file containing variable assignments, adds the variables to the environment, then executes a program.

Interface

     envfile file prog...

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.

Exit codes

0 is not listed because on success, envfile does not exit: it execs into prog.

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, but key or value can never contain whitespace. No quoting is possible.

Empty lines, or lines containing only whitespace, are ignored. Lines beginning with # (possibly after some whitespace) are ignored (and typically used for comments). Comments are also possible at the end of lines: key = value # comment is a valid line. Note that there must be whitespace between value and # in this case (else # is just read as a part of value).

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.

Notes