[JM:02473] Re: [POST:DP] GNU which which.1

Back to archive index
matsuand michio_matsu****@yahoo*****
2021年 6月 1日 (火) 22:47:30 JST


matsuand です。校正確認ありがとうございます。
順次作業進めます。しばらくお時間をください。

1点だけ返信しておきます。


> 今回は PO ファイルを引用の形にしてそこにコメントを書く形にしました。
> コメントを付けるのに、原文をいちいち探して、それをコピペして、というのは
> レビューする側で面倒な部分の(それなりに大きな)1つなので、ご容赦を。
> po4a ベースの翻訳の場合にいつも付きまとう問題ですが、もっと楽な方法があれば
> 教えてください。


1つ、私なりの答えを持っています。
「原文をいちいち探して」という部分への、1つの解です。

私の手元での po4a 処理を、いろいろ工夫しながら進めており、
この which.1 の校正依頼時には、含めていなかったのですが、
以下に **draft** ファイルを示します。

これは以前のメール内にも触れていたのですが、
(1)英文 man ファイルと (2)翻訳 man ファイル から
(3) draft ファイルを「後追い」で作り出したものです。

これを作り出すのは perl スクリプトを作って実現しています。
その perl スクリプトは、一応、本メールに添付します。

以下、draft ファイルです。
英文、邦文を交互に示していますので、校正が楽になりませんか?

---

.\"O .TH WHICH 1
.\"O .rn RS Rs
.\"O .de RS
.\"O .na
.\"O .nf
.\"O .Rs
.\"O ..
.\"O .rn RE Re
.\"O .de RE
.\"O .Re
.\"O .fi
.\"O .ad
.\"O ..
.\"O .de Sx
.TH WHICH 1   
.rn RS Rs
.de  RS
.na
.nf
.Rs
..
.rn RE Re
.de  RE
.Re
.fi
.ad
..
.de  Sx
.\"O ----------------------------------------
.\"O .PP
.\"O .ne \\$1
.PP
.ne \\$1
.\"O ----------------------------------------
.\"O .RS
.\"O ..
.\"O .de Ex
.RS
..
.de  Ex
.\"O ----------------------------------------
.\"O .RE
.RE
.\"O ----------------------------------------
.\"O .PP
.\"O ..
.\"O .na
.PP
..
.na
.\"O ----------------------------------------
.\"O .SH NAME
.\"O which \- shows the full path of (shell) commands.
.SH 名前
which \- (シェル)コマンドのフルパスを表示します
.\"O ----------------------------------------
.\"O .SH SYNOPSIS
.\"O .B which
.\"O [options] [\-\-] programname [...]
.SH 書式
\fBwhich\fP [options] [\-\-] programname [...]
.\"O ----------------------------------------
.\"O .SH DESCRIPTION
.\"O \fBWhich\fR takes one or more arguments. For each of its arguments
.\"O it prints to stdout the full path of the executables
.\"O that would have been executed when this argument had been
.\"O entered at the shell prompt. It does this by searching
.\"O for an executable or script in the directories listed in
.\"O the environment variable \fBPATH\fR using the same algorithm as \fBbash(1)\fR.
.SH 説明
\fBwhich\fP は 1
つまたは複数の引数を取ります。その引数それぞれに対して、その引数がシェルプロンプトから入力された際の、実行されることになる実行モジュールのフルパスを
stdout に出力します。実行モジュールやスクリプトが検索される場所は、環境変数 \fBPATH\fP に列記されたパスです。これは \fBbash(1)\fP
と同じアルゴリズムを用いています。
.\"O ----------------------------------------
.\"O 
.\"O This man page is generated from the file \fIwhich.texinfo\fR.

この man ページは \fIwhich.texinfo\fP ファイルから生成されています。
.\"O ----------------------------------------
.\"O .SH OPTIONS
.SH オプション
.\"O ----------------------------------------

.\"O ----------------------------------------
.\"O .TP 4
.\"O .B --all\fR, \fB-a\fR
.\"O Print all matching executables in \fBPATH\fR, not just the first.
.TP  4
\fB\-\-all\fP, \fB\-a\fP
\fBPATH\fP 内に見つかった実行モジュールすべてを表示します。最初に見つかったものだけではありません。
.\"O ----------------------------------------
.\"O .TP
.\"O .B --read-alias\fR, \fB-i\fR
.\"O Read aliases from stdin, reporting matching ones on
.\"O stdout. This is useful in combination with using an
.\"O alias for which itself. For example
.\"O .br
.\"O .B 
.\"O alias which=\'alias | which -i\'\fR.
.TP 
\fB\-\-read\-alias\fP, \fB\-i\fP
標準入力からエイリアスを読み込んで、合致したものを標準出力します。これは alias と which
そのものを組み合わせて用いると便利です。たとえば以下です。
.br
\fBalias which=\'alias | which \-i\'\fP.
.\"O ----------------------------------------
.\"O .TP
.\"O .B --skip-alias\fR
.\"O Ignore option \`--read-alias\', if any. This is useful to
.\"O explicity search for normal binaries, while using
.\"O the \`--read-alias\' option in an alias or function for which.
.TP 
\fB\-\-skip\-alias\fP
\`\-\-read\-alias\' が指定されても無視します。which に対して \`\-\-read\-alias\'
オプションによりエイリアスや関数を利用している場合であっても、明示的に通常の実行モジュールを検索する場合に利用できます。
.\"O ----------------------------------------
.\"O .TP
.\"O .B --read-functions\fR
.\"O Read shell function definitions from stdin, reporting matching
.\"O ones on stdout. This is useful in combination with using a shell
.\"O function for which itself.  For example:
.\"O .br
.\"O .B 
.\"O which() { declare -f | which --read-functions $@ }
.\"O .br
.\"O export -f which\fR
.TP 
\fB\-\-read\-functions\fP
標準入力からシェル関数定義を読み込んで、合致したものを標準出力します。これはシェル関数と which
そのものを組み合わせて用いると便利です。たとえば以下です。
.br
\fBwhich() { declare \-f | which \-\-read\-functions $@ }\fP
.br
export \-f which
.\"O ----------------------------------------
.\"O .TP
.\"O .B --skip-functions\fR
.\"O Ignore option \`--read-functions\', if any. This is useful to
.\"O explicity search for normal binaries, while using
.\"O the \`--read-functions\' option in an alias or function for which.
.TP 
\fB\-\-skip\-functions\fP
\`\-\-read\-functions\' が指定されても無視します。which に対して \`\-\-read\-functions\'
オプションによりエイリアスや関数を利用している場合であっても、明示的に通常の実行モジュールを検索する場合に利用できます。
.\"O ----------------------------------------
.\"O .TP
.\"O .B --skip-dot\fR
.\"O Skip directories in \fBPATH\fR that start with a dot.
.TP 
\fB\-\-skip\-dot\fP
\fBPATH\fP 内のディレクトリにおいて、ドットで始まるディレクトリは除外します。
.\"O ----------------------------------------
.\"O .TP
.\"O .B --skip-tilde\fR
.\"O Skip directories in \fBPATH\fR that start with a tilde and
.\"O executables which reside in the \fBHOME\fR directory.
.TP 
\fB\-\-skip\-tilde\fP
チルダで始まる \fBPATH\fP 内のディレクトリ、および \fBHOME\fP ディレクトリ内に存在する実行モジュールは除外します。
.\"O ----------------------------------------
.\"O .TP
.\"O .B --show-dot\fR
.\"O If a directory in \fBPATH\fR starts with a dot and a matching
.\"O executable was found for that path, then print
.\"O "./programname" rather than the full path.
.TP 
\fB\-\-show\-dot\fP
\fBPATH\fP 内にドットで始まるディレクトリがあって、合致した実行モジュールがその中に見つかった場合には、フルパスでなく
"./programname" と表示します。
.\"O ----------------------------------------
.\"O .TP
.\"O .B --show-tilde\fR
.\"O Output a tilde when a directory matches the \fBHOME\fR
.\"O directory. This option is ignored when which is
.\"O invoked as root.
.TP 
\fB\-\-show\-tilde\fP
ディレクトリが \fBHOME\fP に合致した場合、チルドを表示します。このオプションは root から実行した際には無視されます。
.\"O ----------------------------------------
.\"O .TP
.\"O .B --tty-only\fR
.\"O Stop processing options on the right if not on tty.
.TP 
\fB\-\-tty\-only\fP
tty 上でない場合、この右側に指定されたオプションの実行を停止します。
.\"O ----------------------------------------
.\"O .TP
.\"O .B --version,-v,-V\fR
.\"O Print version information on standard output then exit
.\"O successfully.
.TP 
\fB\-\-version,\-v,\-V\fP
バージョン情報を標準出力して正常終了します。
.\"O ----------------------------------------
.\"O .TP
.\"O .B --help\fR
.\"O Print usage information on standard output then exit
.\"O successfully.
.TP 
\fB\-\-help\fP
利用方法を標準出力して正常終了します。
.\"O ----------------------------------------
.\"O .SH RETURN VALUE
.\"O \fBWhich\fR returns the number of failed arguments, or -1 when
.\"O no \`programname\' was given.
.SH 返り値
\fBWhich\fP は検索に失敗した引数の数を返します。また \`programname\' が指定されなかった場合は \-1 を返します。
.\"O ----------------------------------------
.\"O .SH EXAMPLE
.\"O The recommended way to use this utility is by adding an alias (C shell)
.\"O or shell function (Bourne shell) for \fBwhich\fR like the following:
.SH 例
このユーティリティーを利用するにあたって推奨されるのは、\fBwhich\fP に対するエイリアス (C シェル) やシェル関数 (Bourne シェル)
を追加して利用する方法です。たとえば以下です。
.\"O ----------------------------------------
.\"O 
.\"O [ba]sh:

[ba]sh の場合:
.\"O ----------------------------------------
.\"O 
.\"O .in +5
.\"O .nf
.\"O .na
.\"O which ()
.\"O {
.\"O   (alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@
.\"O }
.\"O export -f which
.\"O .in -5
.\"O .ad
.\"O .fi

.in +5
.nf
.na
which ()
{
  (alias; declare \-f) | /usr/bin/which \-\-tty\-only \-\-read\-alias \-\-read\-functions \-\-show\-tilde \-\-show\-dot $@
}
export \-f which
.in -5
.ad
.fi
.\"O ----------------------------------------
.\"O 
.\"O [t]csh:

[t]csh の場合:
.\"O ----------------------------------------
.\"O 
.\"O .in +5
.\"O .nf
.\"O .na
.\"O alias which \'alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde\'
.\"O .in -5
.\"O .ad
.\"O .fi

.in +5
.nf
.na
alias which \'alias | /usr/bin/which \-\-tty\-only \-\-read\-alias \-\-show\-dot \-\-show\-tilde\'
.in -5
.ad
.fi
.\"O ----------------------------------------
.\"O 
.\"O This will print the readable ~/ and ./ when starting which
.\"O from your prompt, while still printing the full path when
.\"O used from a script:

こうすることでプロンプトから実行した場合には、見やすいように ~/ や ./
を出力します。一方スクリプトから利用した場合は、そのままフルパスで出力します。
.\"O ----------------------------------------
.\"O 
.\"O .in +5
.\"O .nf
.\"O .na
.\"O > which q2
.\"O ~/bin/q2
.\"O > echo \`which q2\`
.\"O /home/carlo/bin/q2
.\"O .in -5
.\"O .ad
.\"O .fi

.in +5
.nf
.na
> which q2
~/bin/q2
> echo \`which q2\`
/home/carlo/bin/q2
.in -5
.ad
.fi
.\"O ----------------------------------------

.\"O ----------------------------------------
.\"O .SH BUGS
.\"O The \fBHOME\fR directory is determined by looking for the \fBHOME\fR
.\"O environment variable, which aborts when this variable
.\"O doesn\'t exist.  \fBWhich\fR will consider two equivalent directories
.\"O to be different when one of them contains a path
.\"O with a symbolic link.
.SH バグ
\fBHOME\fP ディレクトリは環境変数 \fBHOME\fP により決定されますが、この変数が存在しない場合に処理がキャンセルされます。\fBwhich\fP は
2 つの同等のディレクトリであっても、その 1 つにシンボリックリンクを使ったパスが含まれている場合に、別のディレクトリと取り扱ってしまいます。
.\"O ----------------------------------------
.\"O .SH AUTHOR
.\"O .br
.\"O Carlo Wood <carlo****@gnu*****>
.SH 著者
.br
Carlo Wood <carlo****@gnu*****>
.\"O ----------------------------------------
.\"O .SH "SEE ALSO"
.\"O \fBbash(1)\fR
.SH 関連項目
\fBbash(1)\fP
.\"O ----------------------------------------
-------------- next part --------------
テキスト形式以外の添付ファイルを保管しました...
ファイル名: gendraftfrom.perl
型:         text/x-perl
サイズ:     7340 バイト
説明:       無し
URL:        <https://lists.osdn.me/mailman/archives/linuxjm-discuss/attachments/20210601/857c5b89/attachment-0001.pl>


linuxjm-discuss メーリングリストの案内
Back to archive index