Name

clearenv — clear the entire environment then chain

Synopsis

clearenv [--keep-path] [--keep-user] [--keep-shell] [--keep-term] [--keep-locale] {next-prog}

Description

clearenv is a chain-loading utility that clears the entire environment and then chain loads to next-prog with the execvp(3) function.

next-prog may contain its own command line options, which clearenv will ignore.

When the --keep-path command line option is used, clearenv will not clear the PATH and LD_LIBRARY_PATH environment variables. When the --keep-locale option is used, it will not clear the environment variables used by the GNU C Library for locale settings, namely LANG, LC_ALL, LC_COLLATE. LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, and LC_TIME. Similarly --keep-shell stops the clearing of SHELL; --keep-term stops the clearing of TERM(7), COLORTERM, XTERM_VERSION, VTE_VERSION, and TTY; and --keep-user stops the clearing of HOME, USER, and LOGNAME.

Bugs

As of version 1.34 this program no longer employs the GNU C library nor the BSD C library for environment variable handling. The previously documented workaround for those libraries' having memory leaks in their setenv(3) and clearenv(3) functions, is therefore no longer necessary.

See also

  • unsetenv(1)

  • setenv(1)

  • envdir(1)

  • userenv(1)

Author

Jonathan de Boyne Pollard