xref: /csrg-svn/share/man/man1/cd.1 (revision 50065)
143082Scael.\" Copyright (c) 1980, 1990 The Regents of the University of California.
243082Scael.\" All rights reserved.
319086Smckusick.\"
443082Scael.\" %sccs.include.redist.man%
519086Smckusick.\"
6*50065Sbostic.\"     @(#)cd.1	6.4 (Berkeley) 06/17/91
743082Scael.\"
843082Scael.Dd
943082Scael.Dt CD 1
1043082Scael.Os BSD 4
1143082Scael.Sh NAME
1243082Scael.Nm cd
1343082Scael.Nd change working directory
1443082Scael.Sh SYNOPSIS
1543082Scael.Nm cd
1643082Scael.Ar directory
1743082Scael.Sh DESCRIPTION
18*50065Sbostic.Ar Directory
19*50065Sbosticis an absolute or relative pathname which becomes the new working
20*50065Sbosticdirectory.
21*50065SbosticThe interpretation of a relative pathname by cd depends on the CDPATH
22*50065Sbosticenvironment variable (see below).
2343082Scael.Sh ENVIRONMENT
24*50065SbosticThe following environment variables affect the execution of cd:
2543082Scael.Pp
2644952Scael.Tw Fl
2743082Scael.Tp Ev HOME
2843082ScaelIf
2943082Scael.Nm cd
30*50065Sbosticis invoked without arguments, the
3143082Scael.Ev HOME
32*50065Sbosticenvironment variable is checked for a default directory name.
33*50065SbosticIf
3443082Scael.Ev HOME
35*50065Sbosticexists and contains a directory name, that directory becomes the new
36*50065Sbosticworking directory.
3743082Scael.Tp Ev CDPATH
3843082ScaelIf the
3943082Scael.Ar directory
40*50065Sbosticoperand does not begin with a slash (/) character, and the first
4143082Scaelcomponent is not dot (.) or dot-dot (..),
4243082Scael.Nm cd
43*50065Sbosticsearches for the directory relative to each directory named in the
4443082Scael.Ev CDPATH
4543082Scaelvariable, in the order listed.
46*50065SbosticThe new working directory is set to the first matching directory found.
47*50065SbosticAn empty string in place of a directory pathname represents the current
48*50065Sbosticdirectory.
4943082Scael.Nm Cd
50*50065Sbosticwill print the pathname of the new working directory if it was an element of
5143082Scael.Ev CDPATH .
5243082ScaelSee
5343082Scael.Xr csh 1
5443082Scaelfor info on environment variables.
5543082Scael.Tp
5643082Scael.Pp
5743082ScaelThe
5843082Scael.Nm cd
5943082Scaelutility exits 0 on success, and >0 if an error occurs.
6043082Scael.Sh SEE ALSO
6143082Scael.Xr csh 1 ,
62*50065Sbostic.Xr pwd 1 ,
6343082Scael.Xr sh 1 ,
6443082Scael.Xr chdir 2
6543082Scael.Sh STANDARDS
6643082ScaelThe
6743082Scael.Nm cd
6843082Scaelfunction is expected to be POSIX 1003.2 compatible.
69