xref: /csrg-svn/share/man/man1/cd.1 (revision 61575)
1*61575Sbostic.\" Copyright (c) 1980, 1990, 1993
2*61575Sbostic.\"	The Regents of the University of California.  All rights reserved.
319086Smckusick.\"
450179Sbostic.\" This code is derived from software contributed to Berkeley by
550179Sbostic.\" the Institute of Electrical and Electronics Engineers, Inc.
650179Sbostic.\"
743082Scael.\" %sccs.include.redist.man%
819086Smckusick.\"
9*61575Sbostic.\"     @(#)cd.1	8.1 (Berkeley) 06/05/93
1043082Scael.\"
1143082Scael.Dd
1243082Scael.Dt CD 1
1343082Scael.Os BSD 4
1443082Scael.Sh NAME
1543082Scael.Nm cd
1643082Scael.Nd change working directory
1743082Scael.Sh SYNOPSIS
1843082Scael.Nm cd
1943082Scael.Ar directory
2043082Scael.Sh DESCRIPTION
2150065Sbostic.Ar Directory
2250065Sbosticis an absolute or relative pathname which becomes the new working
2350065Sbosticdirectory.
2450065SbosticThe interpretation of a relative pathname by cd depends on the CDPATH
2550065Sbosticenvironment variable (see below).
2643082Scael.Sh ENVIRONMENT
2750065SbosticThe following environment variables affect the execution of cd:
2843082Scael.Pp
2950067Sbostic.Bl -tag -width indent
3050067Sbostic.It Ev CDPATH
3143082ScaelIf the
3243082Scael.Ar directory
3350065Sbosticoperand does not begin with a slash (/) character, and the first
3443082Scaelcomponent is not dot (.) or dot-dot (..),
3543082Scael.Nm cd
3650065Sbosticsearches for the directory relative to each directory named in the
3743082Scael.Ev CDPATH
3843082Scaelvariable, in the order listed.
3950065SbosticThe new working directory is set to the first matching directory found.
4050065SbosticAn empty string in place of a directory pathname represents the current
4150065Sbosticdirectory.
4250067SbosticIf the new working directory was derived from
4350067Sbostic.Ev CDPATH ,
4450067Sbosticit will be printed to the standard output.
4550067Sbostic.It Ev HOME
4650067SbosticIf
4750067Sbostic.Nm cd
4850067Sbosticis invoked without arguments and the
4950067Sbostic.Ev HOME
5050067Sbosticenvironment variable exists and contains a directory name, that directory
5150067Sbosticbecomes the new working directory.
5250067Sbostic.El
5350067Sbostic.Pp
5443082ScaelSee
5543082Scael.Xr csh 1
5650067Sbosticfor more information on environment variables.
5743082Scael.Pp
5843082ScaelThe
5943082Scael.Nm cd
6043082Scaelutility exits 0 on success, and >0 if an error occurs.
6143082Scael.Sh SEE ALSO
6243082Scael.Xr csh 1 ,
6350065Sbostic.Xr pwd 1 ,
6443082Scael.Xr sh 1 ,
6543082Scael.Xr chdir 2
6643082Scael.Sh STANDARDS
6743082ScaelThe
6843082Scael.Nm cd
6950799Scaelcommand is expected to be
7050799Scael.St -p1003.2
7150799Scaelcompatible.
72