s6: the s6-envdir program
Keywords: s6 command s6-envdir dir environment modification

s6
Software
skarnet.org

# The s6-envdir program

s6-envdir changes its environment, then executes into another program.

## Interface

         s6-envdir [ -I | -i ] [ -n ] [ -f ] [ -c nullis ] dir prog...

- s6-envdir reads files in dir. For every file f in dir, that does not begin with a dot and does not contain the '=' character:
- If f is empty, remove a variable named f from the environment, if any.
- Else add a variable named f to the environment (or replace f if it already exists) with the first line of the contents of file f as value. Spaces and tabs at the end of this line are removed; null characters in this line are changed to newlines in the environment variable.

## Options

- `-i` : strict. If dir does not exist, exit 111 with an error message. This is the default.
- `-I` : loose. If dir does not exist, exec into prog without modifying the environment first.
- `-f` : verbatim mode. All the file is given as the value of the environment variable, including newlines (except the last one if the `-n` option is not given). Null characters are still translated.
- `-n` : do not chomp. If the `-f` option is given and the file ends with a newline, keep that last newline in the value. If the `-f` option is not given, keep the trailing blanks at the end of the first line (but not the ending newline).
- `-c` nullis : replace null characters with the first character of nullis instead of a newline.

## Notes

s6-envdir without options behaves exactly like envdir.