Name

setenv — set an environment variable then chain

Synopsis

setenv {var} {val} {next-prog}

Note

C-shells have a built-in setenv command that does not chain. See the manual for each individual shell for its built-in command.

Description

setenv is a chain-loading utility that sets the environment variable var to the value val and then chain loads to next-prog with the execvp(3) function.

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

An empty val is not the same as unsetting the variable. For that, see unsetenv(1).

If either var or val contain an equals character, counter-intuitive things will happen to the environment.

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

  • appendpath(1)

  • prependpath(1)

  • envdir(1)

  • read-conf(1)

  • printenv(1)

Author

Jonathan de Boyne Pollard