1 \input texinfo @c -*-texinfo-*-
2 @c ===========================================================================
4 @c This file was generated with po4a. Translate the source file.
6 @c ===========================================================================
8 @setfilename which-ja.info
9 @documentencoding UTF-8
10 @settitle @command{which}: コマンドのフルパスを表示する
12 @dircategory System administration
14 * Which-ja: (which-ja). Show full path of commands.
18 @setchapternewpage odd
25 This file documents `which' version 2.x@.
28 Copyright @copyright{} 2000 - 2015, by
30 Carlo Wood, Run on IRC <carlo@@alinoe.com>
31 RSA-1024 0x624ACAD5 1997-01-26 Sign & Encrypt
32 Fingerprint16 = 32 EC A7 B6 AC DB 65 A6 F6 F6 55 DD 1C DC FF 61
34 Japanese Translation Copyright @copyright{} 2023 Linux JM project
36 Permission is granted to make and distribute verbatim copies of
37 this manual provided the copyright notice and this permission notice
38 are preserved on all copies.
42 Permission is granted to copy and distribute modified versions of this
43 manual under the conditions for verbatim copying, provided also that the
44 section entitled ``GNU General Public License'' is included exactly as
45 in the original, and provided that the entire resulting derived work is
46 distributed under the terms of a permission notice identical to this
49 Permission is granted to copy and distribute translations of this manual
50 into another language, under the above conditions for modified versions,
51 except that the section entitled ``GNU General Public License'' may be
52 included in a translation approved by the author instead of in the
55 Note (by the translator): Actually, ``GNU General Public License''
56 is not included in the original version of this info manual.
57 You will get a copy of it at <https://www.gnu.org/licenses/>.
64 @subtitle コマンドのフルパスを表示する
66 @subtitle Edition @value{EDITION}, for Which Version @value{VERSION}
67 @subtitle @value{UPDATED}
69 @author Carlo Wood <@email{carlo@@gnu.org}>
70 @author Translated by Linux JM project
73 @vskip 0pt plus 1filll
74 Copyright @copyright{} 2000 - 2015, by
76 Carlo Wood, Run on IRC <carlo@@alinoe.com> RSA-1024 0x624ACAD5 1997-01-26
77 Sign & Encrypt Fingerprint16 = 32 EC A7 B6 AC DB 65 A6 F6 F6 55 DD 1C DC FF
80 Japanese Translation Copyright @copyright{} 2023 Linux JM project
82 @c The history of the translation
83 @c Translated (version 2.21) Fri Mar 3 11:49:31 JST 2023
84 @c by Chonan Yoichi <cyoichi@maple.con.ne.jp>
89 @node Top, Which Program, (dir), (dir)
90 @top @command{which}: コマンドのフルパスを表示する
96 @command{which} プログラムは、(シェル) コマンドのフルパスを表示する。
99 このファイルは、@command{which} version @value{VERSION}
100 (@value{UPDATED} に更新) について解説している。
103 【読者への御注意】これは、GNU 版の @command{which} コマンドのマニュアルである。
104 @command{which} の実装には、いくつかの系統があるので、お手元の @command{which}
105 が別系統であるときは、オプションなどがここで説明しているものとかなり違うかもしれない。
106 そのときは、お手元の @command{which} に付属するマニュアルをご覧になっていただきたい。
110 * Which Program:: @command{which} プログラムについて
111 * Invoking Which:: @command{which} の起動
112 * Option Summary:: コマンドラインオプション一覧
113 * Return Value:: @command{which} の返り値
116 * See Also:: 関連する UNIX コマンド
120 @node Which Program, Invoking Which, Top, Top
121 @chapter @command{which} プログラムについて
122 @cindex @command{which} の説明
124 @c !BEGIN DESCRIPTION
126 @command{Which} は、ひとつ以上の引数を取り、
127 そうした引数のそれぞれについて、それがシェルのプロンプトから入力されていたら、
128 実行されていたであろう実行ファイルのフルパスを標準出力に表示する。@command{Which}
129 は、それを行うに当たり、@command{bash(1)} と同じアルゴリズムを使って、環境変数
130 @env{PATH} にリストされたディレクトリを調べ、実行ファイルやスクリプトを捜す。
132 @node Invoking Which, Option Summary, Which Program, Top
133 @chapter @command{which} の起動
134 @cindex @command{which} の起動
138 @command{which} 起動の書式は、次のとおりである。
142 which [options] [--] programname [...]
146 @c 以下のメニューはない方がよいので、コメントにしておく。
148 @c * Option Summary:: Option summary
151 @node Option Summary, Return Value, Invoking Which, Top
153 @cindex オプション、コマンドライン
154 @cindex コマンドライン・オプション
155 @cindex コマンドラインオプション一覧
159 @cindex @option{--all}
163 @env{PATH} 中で最初に引数に一致したものだけでなく、一致したすべての実行ファイルを表示する。
165 @cindex @option{--read-alias}
169 標準入力からエイリアスを読み込んで、引数に一致するものを標準出力に書き出す。
170 このオプションは、which コマンドの代わりにエイリアスを使用する場合に、その中で使うとよい。
172 @code{alias which='alias | which -i'}
174 @cindex @option{--skip-alias}
176 @option{--read-alias} オプションが指定されていても、それを無視する。
177 このオプションは、which の代わりに使うエイリアスや関数で @option{--read-alias}
178 オプションを使用している場合に、通常のバイナリを明示的に探すのに役に立つ。
180 @cindex @option{--read-functions}
181 @item --read-functions
182 標準入力からシェル関数の定義を読み込んで、引数に一致するものを標準出力に書き出す。
183 このオプションは、which コマンドの代わりにシェル関数を使用する場合に、
184 その中で使うとよい。たとえば、次のようにだ。@* @code{which () @{ declare -f |
185 /usr/bin/which --read-functions $@@; @}@*export -f which}
187 @cindex @option{--skip-functions}
188 @item --skip-functions
189 @option{--read-functions} が指定されていても、それを無視する。
190 このオプションは、which の代わりに使うエイリアスや関数で @option{--read-functions}
191 オプションを使用している場合に、通常のバイナリを明示的に捜すのに役に立つ。
193 @cindex @option{--skip-dot}
195 環境変数 @env{PATH} 中のドット (.) で始まるパスをスキップする。
196 @footnote{環境変数 @env{PATH} に '.' や './bin'、'.local'
197 などが登録されている場合のことを言っている。'$HOME/.local'
198 といったディレクトリのことではない。そのへんの事情は、@option{--show-dot}
201 @cindex @option{--skip-tilde}
203 @env{PATH} 中のチルダ (~) で始まるディレクトリと、@env{HOME}
204 ディレクトリ以下にある実行ファイルをスキップする。
206 @cindex @option{--show-dot}
208 @env{PATH} 中にドット (.) で始まるパスがあるとき、
209 それに対応するディレクトリで引数に一致する実行ファイルが見つかったら、
210 フルパスではなく "./programname" などと表示する。
212 @cindex @option{--show-tilde}
214 ディレクトリに @env{HOME} ディレクトリが含まれているときは、チルダを出力する。
215 このオプションは、@command{which} が root の権限で実行されている場合には無視される。
217 @cindex @option{--tty-only}
219 出力が端末でない場合は、これより右にあるオプションの処理をしない。
220 @footnote{このオプションに効果があるのは、@option{--show-dot},
221 @option{--show-tilde}, @option{--skip-dot}, @option{--skip-tilde}
224 @cindex @option{--version}
227 @item --version, -v, -V
228 バージョン情報を標準出力に表示して、正常終了する。
230 @cindex @option{--help}
232 使用法を標準出力に表示して、正常終了する。
237 @node Return Value, Example, Option Summary, Top
239 @cindex @command{which} の返り値
241 @c !BEGIN RETURNVALUE
243 @command{Which} は、検索に失敗した引数の個数を返す。引数に
244 @file{programname} が指定されなかった場合には、-1 を返す。
246 @node Example, Bugs, Return Value, Top
252 このユーティリティの使用に当たっては、以下のように、エイリアスや
253 (C shell の場合) シェル関数に (Bourne shell の場合)、@command{which}
254 コマンドの代わりに使用するものを追加しておくことをおすすめする。
262 (alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@@
272 alias which 'alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
277 このようにしておくと、which をプロンプトから実行したときには、パスを ~/
278 や ./ という読みやすい形で表示するが、スクリプトから使用した場合には、
279 通常どおりフルパスの表示になる。@footnote{
280 実際には、こうした関数やエイリアスを端末のプロンプトから実行しようと、
281 スクリプトから実行しようと、表示に変わりはない。
282 出力先が、標準出力や標準エラーか、それ以外かで違いが生じるようである
283 (実行例の二番目では、標準入力に出力している)。念のため、ご自分でお試しいただきたい。}
295 @node Bugs, See Also, Example, Top
301 @env{HOME} ディレクトリの特定は、環境変数 @env{HOME}
302 を調べることで行われるが、この変数が存在しない場合は、@env{HOME}
303 ディレクトリの特定作業は打ち切られる。@footnote{
304 この記述は古いようだ。パッケージ同梱の NEWS ファイルによれば、which-2.19
305 以来、環境変数 @env{HOME} が設定されていない場合は、/etc/passwd
306 ファイルが調べられ、そこでも指定されていない場合は、'/'
307 がホームディレクトリになるとのことである。}
308 また、@command{Which} は、二つのディレクトリが事実上同じものであっても、
309 片方のパスにシンボリックリンクが含まれている場合は、別のディレクトリと見なすことになる。
311 @node See Also, Index, Bugs, Top
318 @node Index, , See Also, Top
319 @comment node-name, next, previous, up