Name

chdir — change working directory then chain

Synopsis

chdir {directory} {next-prog}

NOTE

Most shells have a built-in chdir command that does not chain. See the manual for each individual shell for its built-in command. This command is more commonly used with exec(1) and nosh(1).

Description

chdir is a chain-loading utility that changes its working directory to directory and then chain loads to next-prog with the execvp(3) function.

Note

chdir places no requirement on the value of directory and performs no interpolation upon it. It may be a relative instead of an absolute pathname. Strings that begin with the ~ character are not processed specially.

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

Unlike the shell built-in of the same name, chdir always operates in "physical" mode, ignores any CDPATH environment variable, and performs no canonicalization. For the benefit of the pwd(1) command when its -L command-line option is used, if the path of the directory changed to is an absolute one chdir sets the PWD environment variable to that path, and unsets that environment variable if it is a relative path.

See also

chdir-home(1)

a chain-loading command that uses the value of the HOME environment variable

Author

Jonathan de Boyne Pollard