|
|
Line 52: |
Line 52: |
|
| |
|
| == PARSING == | | == PARSING == |
| This section specifies the format of the second part of the parameters of getopt (the parameters in
| | このセクションでは、getoptのパラメータの2番目の部分('''SYNOPSIS'''のパラメータ)の形式を指定する。 次のセクション([[#OUTPUT]])では、生成される出力について説明する。 これらのパラメータは通常、シェル関数が呼び出されたときのパラメータである。 シェル関数が呼び出された各パラメータが、getoptのパラメータリストにある1つのパラメータに正確に対応するように注意しなければならない([[#EXAMPLES]]を参照)。 すべての解析は GNU '''[https://manpages.debian.org/bookworm/manpages-dev/getopt.3.en.html getopt]'''(3) ルーチンによって行われる。 |
| the SYNOPSIS). The next section (OUTPUT) describes the output that is generated. These parameters
| |
| were typically the parameters a shell function was called with. Care must be taken that each param‐
| |
| eter the shell function was called with corresponds to exactly one parameter in the parameter list
| |
| of getopt (see the EXAMPLES). All parsing is done by the GNU getopt(3) routines.
| |
|
| |
|
| The parameters are parsed from left to right. Each parameter is classified as a short option, a
| | パラメータは左から右に解析される。 各パラメータは、短いオプション、長いオプション、オプションの引数、オプションでないパラメータに分類される。 |
| long option, an argument to an option, or a non-option parameter.
| |
|
| |
|
| A simple short option is a '-' followed by a short option character. If the option has a required
| | 単純な短いオプションは、'-'の後に短いオプション文字が続くものである。 オプションに必須引数がある場合、その引数はオプション文字の直後に書くか、次のパラメータとして書く(つまり、コマンドライン上で空白で区切る)。 オプシ ョ ンにオプシ ョ ナル引数があ る と き は、 オプシ ョ ン文字の後に直接書 く 必要があ る。 |
| argument, it may be written directly after the option character or as the next parameter (i.e., sep‐
| |
| arated by whitespace on the command line). If the option has an optional argument, it must be writ‐
| |
| ten directly after the option character if present.
| |
|
| |
|
| It is possible to specify several short options after one '-', as long as all (except possibly the
| | 1つの'-'の後に複数の短いオプションを指定することも可能で、 その場合、すべてのオプション(おそらく最後のオプションを除く)に 必須引数やオプション引数を指定することはできない。 |
| last) do not have required or optional arguments.
| |
|
| |
|
| A long option normally begins with '--' followed by the long option name. If the option has a re‐
| | 長いオプションは通常、'--'で始まり、長いオプション名が続く。 オプションに必須引数がある場合、その引数は長いオプション名の後に '=' で区切って直接書くか、次の引数として書く(つまり、コマンドライン上で空白で区切る)。 オプションに省略可能な引数がある場合は、長いオプション名の直後に '=' で区切って書かなければならない('=' の後ろに何も書かないと、引数がないものとして解釈される。) 長いオプションは、省略形があいまいでない限り、省略することができる。 |
| quired argument, it may be written directly after the long option name, separated by '=', or as the
| |
| next argument (i.e., separated by whitespace on the command line). If the option has an optional
| |
| argument, it must be written directly after the long option name, separated by '=', if present (if
| |
| you add the '=' but nothing behind it, it is interpreted as if no argument was present; this is a
| |
| slight bug, see the BUGS). Long options may be abbreviated, as long as the abbreviation is not am‐
| |
| biguous.
| |
|
| |
|
| Each parameter not starting with a '-', and not a required argument of a previous option, is a
| | で始まらず、前のオプションの必須引数でもない各パラメータは、 非オプションパラメータである。 '--'パラメータ以降の各パラメータは、常に非オプションパラメータとして解釈される。 環境変数 '''POSIXLY_CORRECT''' が設定されている場合、 または短いオプション文字列が '+' で始まっている場合、 最初の非オプションパラメータが見つかった時点で、 残りのすべてのパラメータは非オプションパラメータとして解釈される。 |
| non-option parameter. Each parameter after a '--' parameter is always interpreted as a non-option
| |
| parameter. If the environment variable POSIXLY_CORRECT is set, or if the short option string
| |
| started with a '+', all remaining parameters are interpreted as non-option parameters as soon as the
| |
| first non-option parameter is found.
| |
|
| |
|
| == OUTPUT == | | == OUTPUT == |