.\" Copyright (c) 1980, 1990, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" This code is derived from software contributed to Berkeley by .\" the Institute of Electrical and Electronics Engineers, Inc. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)cd.1 8.1 (Berkeley) 6/5/93 .\" %Id: cd.1,v 1.1.1.1.8.1 1997/03/07 04:17:49 mpp Exp % .\" jpman %Id: cd.1,v 1.2 1997/03/26 14:56:29 horikawa Stab % .\" .Dd June 5, 1993 .Dt CD 1 .Os BSD 4 .Sh 名称 .Nm cd .Nd ワーキングディレクトリを変更する .Sh 書式 .Nm cd .Ar directory .Sh 解説 .Ar directory には、新しいワーキングディレクトリになる絶対もしくは相対パス名 を記述します。 cd の相対パス名の解釈は、環境変数のCDPATH に依存します(下記参照)。 .Sh 環境変数 以下の環境変数が cd の実行に影響します: .Pp .Bl -tag -width indent .It Ev CDPATH もし、オペランド .Ar directory がスラッシュ (/) で始まらず、かつ、最初がドット (.) やドット-ドット (..) でもない場合、 .Nm cd は環境変数 .Ev CDPATH に記述された各ディレクトリの相対ディレクトリを順番に検索します。 新しいワーキングディレクトリは最初に見つかったディレクトリになります。 .Ev CDPATH でディレクトリ名として空の文字列を指定した場合にはカレントディレクトリを 表します。 新しいワーキングディレクトリが .Ev CDPATH を用いて展開された場合には、その値が標準出力に表示されます。 .It Ev HOME もし .Nm cd が引数無しで起動された場合で、環境変数 .Ev HOME が存在しディレクトリ名が書かれている場合には、 そのディレクトリが新しいワーキングディレクトリになります。 .El .Pp 環境変数に関する詳細については .Xr csh 1 を参照して下さい。 .Pp .Nm cd は成功時には 0 を、エラーが起こった時は 0 より大きな値を返します。 .Sh 関連項目 .Xr csh 1 , .Xr pwd 1 , .Xr sh 1 , .Xr chdir 2 .Sh 規格 .Nm cd は .St -p1003.2 互換のはずです。