MPE/iX Shell and Utilities Reference Manual, Vol 1

cd(1) MPE/iX Shell and Utilities cd(1)
NAME
cd — change working directory
SYNOPSIS
cd [directory]
cd old new
DESCRIPTION
The command
cd directory
changes the working directory of the current shell execution environment (see sh(1)) to
directory.Ifdirectory is an absolute path name, beginning with /, this is the target directory.
If directory is a relative path name, cd assumes it is relative to the current working directory.
In the shell, if the variable
CDPATH
is defined, the built-in cd command searches for a rela-
tive path name under each of the directories defined in
CDPATH
.Ifcd finds the directory out-
side the current working directory, it displays the new working directory.
Use colons to separate directories in
CDPATH
.In
CDPATH
, a null string represents the current
directory. For example, if the value of
CDPATH
begins with a separator character, cd
searches the current directory first; if it ends with a separator character, cd searches the cur-
rent directory last.
In the shell, the command
cd -
is a special case that changes the working directory to the previous working directory by
exchanging the values of the variables
PWD
and
OLDPWD
.
Note: Repeating this command toggles the current working directory between the current and
old working directory.
Calling cd without arguments sets the working directory to the value of the
HOME
environ-
ment variable, if the variable exists. If there is no
HOME
variable, cd does not change the cur-
rent directory.
The form
cd old new
is an extension to traditional KornShell implementations. The shell keeps the name of the
current directory in the variable
PWD
. The cd command scans the current value of
PWD
and
replaces the first occurrence of the string old with the string new. The shell displays the result-
ing value of
PWD
and it becomes the new working directory.
Commands and Utilities 1-83