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"
58 .BI "extern char **" environ ;
64 は「環境 (environment)」と呼ばれる文字列へのポインタの配列である。
65 この配列の最後のポインタの値は NULL である。
66 (この変数はユーザープログラムで宣言しなければならない。
67 ただし libc4 や libc5 のヘッダーファイルなら
69 で宣言されているし、これが glibc 由来のものでも
71 が define されていれば宣言済みとなる)。
75 によって、その起動されたプロセスで利用できるようになる。
79 の文字列は "\fIname\fP\fB=\fP\fIvalue\fP" という書式をとる。
83 ユーザのログイン名 (BSD 起源のプログラムなどによって使用される)。
86 ユーザのログイン名(System V 起源のプログラムなどによって使用される)。
96 ロケールの各カテゴリで使用されるロケールの名前。\fBLC_ALL\fP や、
111 や他のプログラムが、フルパスで与えられなかった実行ファイルを検索するとき、
112 ファイル名に前置されるディレクトリの配列。
113 各ディレクトリは \(aq\fB:\fP\(aq によって区切られる。
115 シェルがディレクトリ変更コマンドの変更先を探すために用いる
118 がマニュアルページの検索に用いる \fBMANPATH\fP などがある。)
121 現在のワーキングディレクトリ。いくつかのシェルが設定する。
127 端末の種類。出力はこれにあわせて用意される。
130 テキストファイルを表示するユーテリティ。ユーザーが好みのものを設定する。
133 テキストファイルを編集するユーテリティ。ユーザーが好みのものを設定する。
136 .\" URL の閲覧に用いるユーティリティ。ユーザーが好みのものを設定する。
137 .\" コロンで区切ってブラウザコマンドを並べる。
138 .\" http://www.catb.org/~esr/BROWSER/ を見よ。
142 では \fIexport\fP コマンドと "name=value" を使用する。
144 では \fIsetenv\fP コマンドを使用する。
146 の引数としても環境を設定することができる。
152 などの関数を用いて環境を扱うことができる。
154 プログラムやライブラリルーチンの多くは、それぞれ適当な環境変数の存在
155 や値によって、動作に影響を受けることがある。以下、適宜挙げてみよう。
157 .BR LANG ", " LANGUAGE ", " NLSPATH ", " LOCPATH ", "
158 .BR LC_ALL ", " LC_MESSAGES ", "
166 などのルーチンによって作成されるファイル名に前置されるパスに影響する。また
168 の一時ディレクトリに用いられたり、他のプログラムからも利用される。
170 .BR LD_LIBRARY_PATH ", " LD_PRELOAD
171 などの LD_* 変数はダイナミックローダ・リンカの動作に影響する。
174 が指定されると、ある種のプログラムやライブラリルーチンは
184 .BR gethostbyname (3)
185 が用いるエイリアスが書かれているファイル名を与える。
195 といった関数で用いられるタイムゾーンの情報を与える。
201 (あるいはそのような情報が書かれているファイル名) を与える。
203 .BR COLUMNS " と " LINES
204 アプリケーションにウインドウのサイズを伝える。
205 実際のサイズとは違う値を与えることもできる。
207 .BR PRINTER " または " LPDEST
214 これらの中には、明らかにセキュリティ上の危険が存在する。
216 .BR IFS " や " LD_LIBRARY_PATH
218 これまで多くのシステムコマンドがだまされて、
225 のようなプログラムでは、デフォルトのユーティリティを
226 環境にある似たような名前の変数で上書きすることができる
242 プログラムに対するオプションとして扱うような流儀も存在してきた。
248 このような利用法は間違っていると考えるべきで、
251 の作者たちは、オプションを与える環境変数を