CD(1) User Commands CD(1) NNAAMMEE cd, chdir, pushd, popd, dirs - change working directory SSYYNNOOPPSSIISS //uussrr//bbiinn//ccdd [_d_i_r_e_c_t_o_r_y] ccsshh ccdd [_d_i_r] cchhddiirr [_d_i_r] ppuusshhdd [++_n | _d_i_r] ppooppdd [++_n] ddiirrss [--ll] kksshh9933 ccdd [--LL] [--PP] [_a_r_g] ccdd _o_l_d _n_e_w DDEESSCCRRIIPPTTIIOONN //uussrr//bbiinn//ccdd The //uussrr//bbiinn//ccdd utility changes the current directory in the context of the ccdd utility only. This is in contrast to the version built into the shell. //uussrr//bbiinn//ccdd has no effect on the invoking process but can be used to determine whether or not a given directory can be set as the current directory. ccsshh If _d_i_r is not specified, the C shell built-in ccdd uses the value of shell parameter HHOOMMEE as the new working directory. If _d_i_r specifies a complete path starting with `//', `..', or `....', _d_i_r becomes the new working directory. If neither case applies, ccdd tries to find the designated directory relative to one of the paths specified by the CCDDPPAATTHH shell variable. CCDDPPAATTHH has the same syntax as, and similar semantics to, the PPAATTHH shell variable. ccdd must have execute (search) permission in _d_i_r. Because a new process is created to execute each command, ccdd would be ineffective if it were written as a normal command; therefore, it is recognized by and is internal to the C-shell. (See ppwwdd(1), sshh(1), and cchhddiirr(2)). cchhddiirr changes the shell's working directory to directory _d_i_r. If no argument is given, change to the home directory of the user. If _d_i_r is a relative pathname not found in the current directory, check for it in those directories listed in the ccddppaatthh variable. If _d_i_r is the name of a shell variable whose value starts with a //, change to the directory named by that value. ppuusshhdd pushes a directory onto the directory stack. With no arguments, exchange the top two elements. ++_n Rotate the _n'th entry to the top of the stack and ccdd to it. _d_i_r Push the current working directory onto the stack and change to _d_i_r. ppooppdd pops the directory stack and ccdd to the new top directory. The elements of the directory stack are numbered from 0 starting at the top. ++_n Discard the _n'th entry in the stack. ddiirrss prints the directory stack, most recent to the left; the first directory shown is the current directory. With the --ll argument, produce an unabbreviated printout; use of the ~~ notation is suppressed. kksshh9933 The Korn shell built-in ccdd command can be in either of two forms. In the first form it changes the current directory to _a_r_g. If _a_r_g is -- the directory is changed to the previous directory. The shell variable HHOOMMEE is the default _a_r_g. The environment variable PPWWDD is set to the current directory. If the PPWWDD is changed, the OOLLDDPPWWDD environment variable shall also be changed to the value of the old working directory, that is, the current working directory immediately prior to the call to change directory (ccdd). The shell variable CCDDPPAATTHH defines the search path for the directory containing _a_r_g. Alternative directory names are separated by a colon (::). The default path is nnuullll (specifying the current directory). The current directory is specified by a null path name, which can appear immediately after the equal sign or between the colon delimiters anywhere else in the path list. If _a_r_g begins with a `//', `..', or `....', then the search path is not used. Otherwise, each directory in the path is searched for _a_r_g. If unsuccessful, ccdd attempts to change directories to the pathname formed by the concatenation of the value of PWD, a slash character, and arg. --LL Handles the operation dot-dot (....) logically. Symbolic link components are nnoott resolved before dot-dot components are processed. --PP Handles the operand dot-dot physically. Symbolic link components aarree resolved before dot-dot components are processed. If both --LL and --PP options are specified, the last option to be invoked is used and the other is ignored. If neither --LL nor --PP is specified, the operand is handled dot-dot logically. The second form of ccdd substitutes the string _n_e_w for the string _o_l_d in the current directory name, PPWWDD and tries to change to this new directory. The ccdd command cannot be executed by rrkksshh. Because a new process is created to execute each command, ccdd would be ineffective if it were written as a normal command; therefore, it is recognized by and is internal to the Korn shell. (See ppwwdd(1), kksshh9933(1), and cchhddiirr(2)). OOPPEERRAANNDDSS The following operands are supported: _d_i_r_e_c_t_o_r_y An absolute or relative pathname of the directory that becomes the new working directory. The interpretation of a relative pathname by ccdd depends on the CCDDPPAATTHH environment variable. OOUUTTPPUUTT If a non-empty directory name from CCDDPPAATTHH is used, an absolute pathname of the new working directory is written to the standard output as follows: ""%%ss\\nn"", <_n_e_w _d_i_r_e_c_t_o_r_y> Otherwise, there is no output. EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS See eennvviirroonn(5) for descriptions of the following environment variables that affect the execution of ccdd: LLAANNGG, LLCC__AALLLL, LLCC__CCTTYYPPEE, LLCC__MMEESSSSAAGGEESS, and NNLLSSPPAATTHH. CCDDPPAATTHH A colon-separated list of pathnames that refer to directories. If the _d_i_r_e_c_t_o_r_y operand does not begin with a slash (( // )) character, and the first component is not dot or dot-dot, ccdd searches for _d_i_r_e_c_t_o_r_y relative to each directory named in the CCDDPPAATTHH variable, in the order listed. The new working directory sets to the first matching directory found. An empty string in place of a directory pathname represents the current directory. If CCDDPPAATTHH is not set, it is treated as if it were an empty string. HHOOMMEE The name of the home directory, used when no _d_i_r_e_c_t_o_r_y operand is specified. OOLLDDPPWWDD A pathname of the previous working directory, used by ccdd--. PPWWDD A pathname of the current working directory, set by ccdd after it has changed to that directory. EEXXIITT SSTTAATTUUSS The following exit values are returned by ccdd: 00 The directory was successfully changed. >>00 An error occurred. AATTTTRRIIBBUUTTEESS See aattttrriibbuutteess(5) for descriptions of the following attributes: ccsshh +--------------------+-------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+-------------------+ |Interface Stability | Committed | +--------------------+-------------------+ |Standard | See ssttaannddaarrddss(5). | +--------------------+-------------------+ kksshh9933 +--------------------+-----------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+-----------------+ |Interface Stability | Uncommitted | +--------------------+-----------------+ SSEEEE AALLSSOO ccsshh(1), kksshh9933(1), ppwwdd(1), cchhddiirr(2), aattttrriibbuutteess(5), eennvviirroonn(5), ssttaannddaarrddss(5) February 9, 2021 CD(1)