|
|
1.1 root 1: .\" Copyright (c) 1980, 1990 The Regents of the University of California.
2: .\" All rights reserved.
3: .\"
4: .\" Redistribution and use in source and binary forms are permitted provided
5: .\" that: (1) source distributions retain this entire copyright notice and
6: .\" comment, and (2) distributions including binaries display the following
7: .\" acknowledgement: ``This product includes software developed by the
8: .\" University of California, Berkeley and its contributors'' in the
9: .\" documentation or other materials provided with the distribution and in
10: .\" all advertising materials mentioning features or use of this software.
11: .\" Neither the name of the University nor the names of its contributors may
12: .\" be used to endorse or promote products derived from this software without
13: .\" specific prior written permission.
14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
15: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
16: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17: .\"
18: .\" @(#)cd.1 6.3 (Berkeley) 7/24/90
19: .\"
20: .Dd July 24, 1990
21: .Dt CD 1
22: .Os BSD 4
23: .Sh NAME
24: .Nm cd
25: .Nd change working directory
26: .Sh SYNOPSIS
27: .Nm cd
28: .Ar directory
29: .Sh DESCRIPTION
30: The cd utility changes the working directory
31: to
32: .Ar directory .
33: .Pp
34: The
35: .Ar directory
36: is an absolute or relative pathname
37: which becomes the new working directory.
38: The
39: interpretation of a relative pathname by cd depends
40: on the CDPATH environment variable (see below).
41: .Pp
42: .Sh ENVIRONMENT
43: The following environment variables affect the execution of
44: cd:
45: .Pp
46: .Tw Fl
47: .Tp Ev HOME
48: If
49: .Nm cd
50: is
51: invoked without arguments, the
52: .Ev HOME
53: environment variable is checked for a default
54: directory name. If
55: .Ev HOME
56: exists and contains
57: a directory name,
58: that directory becomes the new working directory.
59: .Tp Ev CDPATH
60: If the
61: .Ar directory
62: operand does not
63: begin with a slash (/) character, and the first
64: component is not dot (.) or dot-dot (..),
65: .Nm cd
66: searches for
67: the directory relative to each directory named in the
68: .Ev CDPATH
69: variable, in the order listed.
70: The new
71: working directory is set to the first matching
72: directory found.
73: An empty string in place of a
74: directory pathname represents the current directory.
75: .Nm Cd
76: will print the pathname of the new working directory if it
77: was an element of
78: .Ev CDPATH .
79: See
80: .Xr csh 1
81: for info on environment variables.
82: .Tp
83: .Pp
84: The
85: .Nm cd
86: utility exits 0 on success, and >0 if an error occurs.
87: .Sh SEE ALSO
88: .Xr csh 1 ,
89: .Xr sh 1 ,
90: .Xr pwd 1 ,
91: .Xr chdir 2
92: .Sh STANDARDS
93: The
94: .Nm cd
95: function is expected to be POSIX 1003.2 compatible.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.