1 .\" Copyright (c) 1993 Michael Haardt (michael@moria.de),
2 .\" Fri Apr 2 11:32:09 MET DST 1993
3 .\" and Andries Brouwer (aeb@cwi.nl), Fri Feb 14 21:47:50 1997.
5 .\" This is free documentation; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License as
7 .\" published by the Free Software Foundation; either version 2 of
8 .\" the License, or (at your option) any later version.
10 .\" The GNU General Public License's references to "object code"
11 .\" and "executables" are to be interpreted as the output of any
12 .\" document formatting or typesetting system, including
13 .\" intermediate and printed output.
15 .\" This manual is distributed in the hope that it will be useful,
16 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
17 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 .\" GNU General Public License for more details.
20 .\" You should have received a copy of the GNU General Public
21 .\" License along with this manual; if not, write to the Free
22 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
25 .\" Modified Sun Jul 25 10:45:30 1993 by Rik Faith (faith@cs.unc.edu)
26 .\" Modified Sun Jul 21 21:25:26 1996 by Andries Brouwer (aeb@cwi.nl)
27 .\" Modified Mon Oct 21 17:47:19 1996 by Eric S. Raymond (esr@thyrsus.com)
28 .\" Modified Wed Aug 27 20:28:58 1997 by Nicolas Lichtmaier (nick@debian.org)
29 .\" Modified Mon Sep 21 00:00:26 1998 by Andries Brouwer (aeb@cwi.nl)
30 .\" Modified Wed Jan 24 06:37:24 2001 by Eric S. Raymond (esr@thyrsus.com)
31 .\" Modified Thu Dec 13 23:53:27 2001 by Martin Schulze <joey@infodrom.org>
33 .\" nakano 注: Nicolas さんの a はオリジナルでは \'a だが,
34 .\" キャラクタを壊すので a に変更した.
36 .\" Japanese Version Copyright (c) 1997 KURODA Masaru all rights reserved.
37 .\" Translated May 27, 1997 by KURODA Masaru <kuro@st.rim.or.jp>
38 .\" Modified Sat 25 Jul 1998 by NAKANO Takeo <nakano@apm.seikei.ac.jp>
39 .\" Modified Sun 6 Dec 1998 by NAKANO Takeo <nakano@apm.seikei.ac.jp>
40 .\" Updated & Modified Sat Aug 21 1999
41 .\" by NAKANO Takeo <nakano@apm.seikei.ac.jp>
42 .\" Updated & Modified Sat 18 Mar 2000 by NAKANO Takeo
43 .\" Updated Sat Dec 22 JST 2001 by Kentaro Shirakata <argrath@ub32.org>
44 .\" Updated Sat Mar 23 JST 2002 by Kentaro Shirakata <argrath@ub32.org>
45 .\" Updated 2010-04-11, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.24
47 .\"WORD: environment 環境
48 .\"WORD: environment variable 環境変数
49 .\"WORD: shell variable シェル変数
51 .\"WORD: locale category ロケールカテゴリ
53 .TH ENVIRON 7 2009-07-25 "Linux" "Linux Programmer's Manual"
55 .\"O environ \- user environment
61 .BI "extern char **" environ ;
68 .\"O points to an array of pointers to strings called the "environment".
69 .\"O The last pointer in this array has the value NULL.
70 .\"O (This variable must be declared in the user program,
71 .\"O but is declared in the header file
73 .\"O in case the header files came from libc4 or libc5, and
74 .\"O in case they came from glibc and
77 .\"O This array of strings is made available to the process by the
79 .\"O call that started the process.
82 は「環境 (environment)」と呼ばれる文字列へのポインタの配列である。
83 この配列の最後のポインタの値は NULL である。
84 (この変数はユーザープログラムで宣言しなければならない。
85 ただし libc4 や libc5 のヘッダーファイルなら
87 で宣言されているし、これが glibc 由来のものでも
89 が define されていれば宣言済みとなる)。
93 によって、その起動されたプロセスで利用できるようになる。
95 .\"O By convention the strings in
97 .\"O have the form "\fIname\fP\fB=\fP\fIvalue\fP".
98 .\"O Common examples are:
101 の文字列は "\fIname\fP\fB=\fP\fIvalue\fP" という書式をとる。
105 .\"O The name of the logged-in user (used by some BSD-derived programs).
106 ユーザのログイン名 (BSD 起源のプログラムなどによって使用される)。
109 .\"O The name of the logged-in user (used by some System-V derived programs).
110 ユーザのログイン名(System V 起源のプログラムなどによって使用される)。
113 .\"O A user's login directory, set by
115 .\"O from the password file
124 .\"O The name of a locale to use for locale categories when not overridden
125 .\"O by \fBLC_ALL\fP or more specific environment variables like
126 .\"O \fBLC_COLLATE\fP, \fBLC_CTYPE\fP, \fBLC_MESSAGES\fP, \fBLC_MONETARY\fP,
127 .\"O \fBLC_NUMERIC\fP, \fBLC_TIME\fP, cf.
129 ロケールの各カテゴリで使用されるロケールの名前。\fBLC_ALL\fP や、
143 .\"O The sequence of directory prefixes that
146 .\"O programs apply in searching for a file known by an incomplete pathname.
147 .\"O The prefixes are separated by \(aq\fB:\fP\(aq.
148 .\"O (Similarly one has \fBCDPATH\fP used by some shells to find the target
149 .\"O of a change directory command, \fBMANPATH\fP used by
152 .\"O find manual pages, etc.)
154 や他のプログラムが、フルパスで与えられなかった実行ファイルを検索するとき、
155 ファイル名に前置されるディレクトリの配列。
156 各ディレクトリは \(aq\fB:\fP\(aq によって区切られる。
158 シェルがディレクトリ変更コマンドの変更先を探すために用いる
161 がマニュアルページの検索に用いる \fBMANPATH\fP などがある。)
164 .\"O The current working directory.
165 .\"O Set by some shells.
166 現在のワーキングディレクトリ。いくつかのシェルが設定する。
169 .\"O The pathname of the user's login shell.
173 .\"O The terminal type for which output is to be prepared.
174 端末の種類。出力はこれにあわせて用意される。
177 .\"O The user's preferred utility to display text files.
178 テキストファイルを表示するユーテリティ。ユーザーが好みのものを設定する。
181 .\"O The user's preferred utility to edit text files.
182 テキストファイルを編集するユーテリティ。ユーザーが好みのものを設定する。
185 .\"O .\" The user's preferred utility to browse URLs. Sequence of colon-separated
186 .\"O .\" browser commands. See http://www.catb.org/~esr/BROWSER/ .
187 .\" URL の閲覧に用いるユーティリティ。ユーザーが好みのものを設定する。
188 .\" コロンで区切ってブラウザコマンドを並べる。
189 .\" http://www.catb.org/~esr/BROWSER/ を見よ。
191 .\"O Further names may be placed in the environment by the \fIexport\fP
192 .\"O command and "name=value" in
194 .\"O or by the \fIsetenv\fP command if you use
196 .\"O Arguments may also be placed in the
197 .\"O environment at the point of an
199 .\"O A C program can manipulate its environment using the functions
204 .\"O .BR unsetenv (3).
207 では \fIexport\fP コマンドと "name=value" を使用する。
209 では \fIsetenv\fP コマンドを使用する。
211 の引数としても環境を設定することができる。
217 などの関数を用いて環境を扱うことができる。
219 .\"O Note that the behavior of many programs and library routines is
220 .\"O influenced by the presence or value of certain environment variables.
221 .\"O A random collection:
222 プログラムやライブラリルーチンの多くは、それぞれ適当な環境変数の存在
223 や値によって、動作に影響を受けることがある。以下、適宜挙げてみよう。
226 .\"O .BR LANG ", " LANGUAGE ", " NLSPATH ", " LOCPATH ", "
227 .\"O .BR LC_ALL ", " LC_MESSAGES ", "
228 .\"O etc. influence locale handling, cf.
230 .BR LANG ", " LANGUAGE ", " NLSPATH ", " LOCPATH ", "
231 .BR LC_ALL ", " LC_MESSAGES ", "
237 .\"O influences the path prefix of names created by
239 .\"O and other routines, the temporary directory used by
241 .\"O and other programs, etc.
245 などのルーチンによって作成されるファイル名に前置されるパスに影響する。また
247 の一時ディレクトリに用いられたり、他のプログラムからも利用される。
249 .\"O .BR LD_LIBRARY_PATH ", " LD_PRELOAD
250 .\"O and other LD_* variables influence
251 .\"O the behavior of the dynamic loader/linker.
252 .BR LD_LIBRARY_PATH ", " LD_PRELOAD
253 などの LD_* 変数はダイナミックローダ・リンカの動作に影響する。
255 .\"O .B POSIXLY_CORRECT
256 .\"O makes certain programs and library routines follow
257 .\"O the prescriptions of POSIX.
259 が指定されると、ある種のプログラムやライブラリルーチンは
264 .\"O is influenced by
274 .\"O gives the name of a file containing aliases
276 .\"O .BR gethostbyname (3).
279 .BR gethostbyname (3)
280 が用いるエイリアスが書かれているファイル名を与える。
282 .\"O .BR TZ " and " TZDIR
283 .\"O give timezone information used by
285 .\"O and through that by functions like
287 .\"O .BR localtime (3),
289 .\"O .BR strftime (3).
291 .\"O .BR tzselect (8).
300 といった関数で用いられるタイムゾーンの情報を与える。
305 .\"O gives information on how to address a given terminal
306 .\"O (or gives the name of a file containing such information).
309 (あるいはそのような情報が書かれているファイル名) を与える。
311 .\"O .BR COLUMNS " and " LINES
312 .\"O tell applications about the window size, possibly overriding the actual size.
313 .BR COLUMNS " と " LINES
314 アプリケーションにウインドウのサイズを伝える。
315 実際のサイズとは違う値を与えることもできる。
317 .\"O .BR PRINTER " or " LPDEST
318 .BR PRINTER " または " LPDEST
319 .\"O may specify the desired printer to use.
330 .\"O Clearly there is a security risk here.
331 .\"O Many a system command has been
332 .\"O tricked into mischief by a user who specified unusual values for
333 .\"O .BR IFS " or " LD_LIBRARY_PATH .
334 これらの中には、明らかにセキュリティ上の危険が存在する。
336 .BR IFS " や " LD_LIBRARY_PATH
338 これまで多くのシステムコマンドがだまされて、
341 .\"O There is also the risk of name space pollution.
346 .\"O allow overriding of default utility names from the
347 .\"O environment with similarly named variables in all caps.
350 .\"O to select the desired C compiler (and similarly
364 のようなプログラムでは、デフォルトのユーティリティを
365 環境にある似たような名前の変数で上書きすることができる
379 .\"O However, in some traditional uses such an environment variable
380 .\"O gives options for the program instead of a pathname.
386 .\"O Such usage is considered mistaken, and to be avoided in new
390 .\"O should consider renaming their option to
394 プログラムに対するオプションとして扱うような流儀も存在してきた。
400 このような利用法は間違っていると考えるべきで、
403 の作者たちは、オプションを与える環境変数を