Document all POSIXly-correct behavior
All the effects of the POSIXly-correct mode are now documented in
posix.txt and the built-in command manual pages.
@@ -15,9 +15,13 @@ | ||
15 | 15 | |
16 | 16 | The cd built-in changes the working directory to the directory specified by |
17 | 17 | the operand. |
18 | + | |
18 | 19 | The pathname of the new working directory is assigned to the |
19 | 20 | link:params.html#sv-pwd[+PWD+ variable], whose previous value is again |
20 | 21 | assigned to the link:params.html#sv-oldpwd[+OLDPWD+ variable]. |
22 | +The new +PWD+ value will not contain any +.+ or +..+ components except when | |
23 | +the shell is in the link:posix.html[POSIXly-correct mode] and the new pathname | |
24 | +begins with +/..+. | |
21 | 25 | |
22 | 26 | If {{directory}} is a relative path that does not start with `.' or `..', |
23 | 27 | paths in the link:params.html#sv-cdpath[+CDPATH+ variable] are searched to |
@@ -20,6 +20,8 @@ | ||
20 | 20 | it. |
21 | 21 | |
22 | 22 | The name of the job is printed when the job is resumed. |
23 | +When not in the link:posix.html[POSIXly-correct mode], the job number is also | |
24 | +printed. | |
23 | 25 | |
24 | 26 | The built-in can be used only when link:job.html[job control] is enabled. |
25 | 27 |
@@ -108,4 +108,7 @@ | ||
108 | 108 | The POSIX standard does not specify what will happen when the +OPTIND+ |
109 | 109 | variable is assigned a value other than +1+. |
110 | 110 | |
111 | +In the link:posix.html[POSIXly-correct mode], option characters in | |
112 | +{{optionlist}} must be alphanumeric. | |
113 | + | |
111 | 114 | // vim: set filetype=asciidoc textwidth=78 expandtab: |
@@ -54,6 +54,9 @@ | ||
54 | 54 | {{job}}s:: |
55 | 55 | The link:job.html#jobid[job IDs] of jobs to be reported. |
56 | 56 | When no {{job}} is specified, all jobs under the shell's control are reported. |
57 | ++ | |
58 | +The percent sign (+%+) at the beginning of a job ID can be omitted if the | |
59 | +shell is not in the link:posix.html[POSIXly-correct mode]. | |
57 | 60 | |
58 | 61 | [[exitstatus]] |
59 | 62 | == Exit status |
@@ -204,4 +204,9 @@ | ||
204 | 204 | character because all multibyte characters are converted to wide characters |
205 | 205 | when processed in the shell. |
206 | 206 | |
207 | +If the shell is not in the link:posix.html[POSIXly-correct mode] and the | |
208 | +``long double'' floating-point arithmetic is supported on the running system, | |
209 | +then ``long double'' is used for floating-point conversion specifications. | |
210 | +Otherwise, ``double'' is used. | |
211 | + | |
207 | 212 | // vim: set filetype=asciidoc textwidth=78 expandtab: |
@@ -26,6 +26,10 @@ | ||
26 | 26 | If the shell receives a SIGINT signal when job control is enabled, the |
27 | 27 | built-in aborts waiting. |
28 | 28 | |
29 | +If the shell is link:interact.html[interactive], | |
30 | +link:job.html[job-controlling], and not in the link:posix.html[POSIXly-correct | |
31 | +mode], the job status is printed when the job is terminated or stopped. | |
32 | + | |
29 | 33 | [[operands]] |
30 | 34 | == Operands |
31 | 35 |
@@ -13,8 +13,10 @@ | ||
13 | 13 | [[description]] |
14 | 14 | == 説明 |
15 | 15 | |
16 | -Cd コマンドはシェルの作業ディレクトリをオペランドで指定したディレクトリに変更します。新しい作業ディレクトリに応じて link:params.html#sv-pwd[+PWD+ 変数]の値が再設定されるとともに、前の +PWD+ 変数の値が link:params.html#sv-oldpwd[+OLDPWD+ 変数]に設定されます。 | |
16 | +Cd コマンドはシェルの作業ディレクトリをオペランドで指定したディレクトリに変更します。 | |
17 | 17 | |
18 | +新しい作業ディレクトリに応じて link:params.html#sv-pwd[+PWD+ 変数]の値が再設定されるとともに、前の +PWD+ 変数の値が link:params.html#sv-oldpwd[+OLDPWD+ 変数]に設定されます。新しい +PWD+ の値は +.+ や +..+ のディレクトリ成分を含みません (link:posix.html[POSIX 準拠モード]で新しいパスが +/..+ で始まる場合を除く)。 | |
19 | + | |
18 | 20 | 指定した{{ディレクトリ}}が相対パスの場合 (最初が +.+ または +..+ で始まるものを除く)、{zwsp}link:exec.html#search[コマンドの検索]における link:params.html#sv-path[+PATH+ 変数]の検索と同様にして、{zwsp}link:params.html#sv-cdpath[+CDPATH+ 変数]の値にあるコロンで区切った各ディレクトリ内に指定した{{ディレクトリ}}があるかどうか調べます。ディレクトリが見つかった場合は、そのディレクトリが新しい作業ディレクトリになります。見つからなかった場合は、{{ディレクトリ}}は現在の作業ディレクトリからの相対パスとなります。 |
19 | 21 | |
20 | 22 | +CDPATH+ 変数の検索で新しい作業ディレクトリが見つかった場合または{{ディレクトリ}}として +-+ が指定された場合は新しい作業ディレクトリのパスを標準出力に出力します。 |
@@ -16,6 +16,7 @@ | ||
16 | 16 | Fg コマンドはジョブをフォアグラウンドに移動し SIGCONT シグナルを送ります。これにより、ジョブが停止していた場合はフォアグラウンドで実行が再開されます。Fg コマンドはジョブの実行が終了するまで待機し、ジョブの終了ステータスを返します。 |
17 | 17 | |
18 | 18 | ジョブの実行を再開する前に fg コマンドはジョブの名前を標準出力に出力します。 |
19 | +非 link:posix.html[POSIX 準拠モード]ではジョブの番号も出力されます。 | |
19 | 20 | |
20 | 21 | Fg コマンドは{zwsp}link:job.html[ジョブ制御]が有効な時しか使えません。 |
21 | 22 |
@@ -77,4 +77,6 @@ | ||
77 | 77 | |
78 | 78 | POSIX は、+OPTIND+ 変数に +1+ 以外の値を代入した場合の動作を規定していません。 |
79 | 79 | |
80 | +link:posix.html[POSIX 準拠モード]では、{{オプションリスト}}に含まれるオプションは英数字でなければなりません。 | |
81 | + | |
80 | 82 | // vim: set filetype=asciidoc expandtab: |
@@ -50,6 +50,8 @@ | ||
50 | 50 | |
51 | 51 | {{ジョブ}}:: |
52 | 52 | 表示するジョブの{zwsp}link:job.html#jobid[ジョブ ID] です。一つも指定しない場合は全てのジョブを表示します。 |
53 | ++ | |
54 | +非 link:posix.html[POSIX 準拠モード]ではジョブ ID の先頭の +%+ は省略できます。 | |
53 | 55 | |
54 | 56 | [[exitstatus]] |
55 | 57 | == 終了ステータス |
@@ -149,4 +149,6 @@ | ||
149 | 149 | |
150 | 150 | POSIX では、マルチバイト文字の扱いについて厳密に定義していません。+%s+ 変換指定で精度を指定した場合や、+%c+ 変換指定を使用する場合、値にマルチバイト文字が含まれていると適切な出力が得られないかもしれません。Yash では、マルチバイト文字は全てワイド文字に変換してから処理するので、マルチバイト文字の一部のバイトだけが出力されるようなことはありません。 |
151 | 151 | |
152 | +シェルが非 link:posix.html[POSIX 準拠モード]で、システム上で ``long double'' 浮動小数点数が使用可能な場合は、実数の変換指定は ``long double'' で処理されます。それ以外の場合は ``double'' で処理されます。 | |
153 | + | |
152 | 154 | // vim: set filetype=asciidoc expandtab: |
@@ -19,6 +19,8 @@ | ||
19 | 19 | |
20 | 20 | Wait コマンドの実行中にシェルがシグナルを受信した場合、そのシグナルに対し{zwsp}link:_trap.html[トラップ]が設定してあればそのトラップを直ちに実行し wait コマンドはそのまま終了します。またジョブ制御が有効な場合、シェルが SIGINT シグナルを受信すると wait コマンドは中断されます。 |
21 | 21 | |
22 | +シェルが{zwsp}link:interact.html[対話モード]で、{zwsp}link:job.html[ジョブ制御]が有効で、非 link:posix.html[POSIX 準拠モード]のとき、ジョブが終了または停止した時にジョブの状態を出力します。 | |
23 | + | |
22 | 24 | [[operands]] |
23 | 25 | == オペランド |
24 | 26 |
@@ -11,25 +11,28 @@ | ||
11 | 11 | POSIX 準拠モードを有効にすると、yash は POSIX の規定にできるだけ従うようになるだけでなく、POSIX が__未定義__や__未規定__と定めている場合のほとんどをエラーにするようになります。すなわち、yash 独自の拡張機能の多くは使えなくなります。具体的には、POSIX 準拠モードを有効にすると以下のような挙動の変化があります。 |
12 | 12 | |
13 | 13 | - シェルの起動時の{zwsp}link:invoke.html#init[初期化]で読み込むスクリプトファイルが異なります。 |
14 | +- シェルが link:invoke.html#arguments[+-c+ オプション]で起動された場合、構文エラー時に +yash -c+ の代わりに +sh -c+ をファイル名として表示します。 | |
14 | 15 | - グローバル{zwsp}link:syntax.html#aliases[エイリアス]の置換を行いません。 |
15 | 16 | - link:syntax.html#compound[複合コマンド]の{zwsp}link:syntax.html#grouping[グルーピング]や link:syntax.html#if[if 文]の内容が空の場合エラーになります。 |
16 | 17 | - link:syntax.html#for[For ループ]で展開した単語はグローバル変数として代入します。変数名はポータブルな (すなわち ASCII の範囲内の) 文字しか使えません。 |
17 | 18 | - link:syntax.html#case[Case 文]の最初のパターンを +esac+ にすることはできません。 |
19 | +- 予約語 +!+ の直後に空白を置かずに +(+ を置くことはできません。 | |
18 | 20 | - 予約語 +function+ を用いる形式の{zwsp}link:syntax.html#funcdef[関数定義]構文は使えません。関数名はポータブルな (すなわち ASCII の範囲内の) 文字しか使えません。 |
19 | 21 | - link:syntax.html#simple[単純コマンド]での{zwsp}link:params.html#arrays[配列]の代入はできません。 |
20 | 22 | - シェル実行中に link:params.html#sv-lc_ctype[+LC_CTYPE+ 変数]の値が変わっても、それをシェルのロケール情報に反映しません。 |
21 | 23 | - link:params.html#sv-random[+RANDOM+ 変数]は使えません。 |
22 | 24 | - link:expand.html#tilde[チルダ展開]で +~+ と +~{{ユーザ名}}+ 以外の形式の展開が使えません。 |
23 | -- link:expand.html#params[パラメータ展開]の{zwsp}link:expand.html#param-name[入れ子]はできません。また{zwsp}link:expand.html#param-index[インデックス]の指定はできません。 | |
25 | +- link:expand.html#params[パラメータ展開]の{zwsp}link:expand.html#param-name[入れ子]はできません。また{zwsp}link:expand.html#param-index[インデックス]および{{単語2}}のある{zwsp}link:expand.html#param-mod[加工指定]は使用できません。 | |
24 | 26 | - +$(+ と +)+ で囲んだ{zwsp}link:expand.html#cmdsub[コマンド置換]に含まれるコマンドは、コマンド置換が実行される時に毎回解析されます。 |
25 | 27 | - link:expand.html#arith[数式展開]で小数ならびに `++` および `--` 演算子が使えません。数値でない変数は常にエラーになります。 |
26 | 28 | - link:redir.html[リダイレクト]の対象を示すトークンは次のリダイレクトのファイル記述子を示す整数と紛らわしくないようにしなければなりません。 |
27 | 29 | - link:redir.html[リダイレクト]を伴う{zwsp}link:syntax.html#compound[複合コマンド]の直後に +}+ や +fi+ などの予約語を置くことはできません。 |
28 | 30 | - link:redir.html#file[ファイルのリダイレクト]で、{zwsp}link:expand.html#glob[パス名展開]の結果が一つでない場合、すぐにはエラーにせず、パス名展開を行わなかったときと同様に扱います。 |
31 | +- +<&+ および +>&+ link:redir.html#dup[リダイレクト]演算子の対象となるファイル記述子はそれぞれ読み込み可能および書き込み可能でなければなりません。 | |
29 | 32 | - link:redir.html#socket[ソケットリダイレクト]・{zwsp}link:redir.html#here[ヒアストリング]・{zwsp}link:redir.html#pipe[パイプリダイレクト]・{zwsp}link:redir.html#process[プロセスリダイレクト]は使用できません。 |
30 | 33 | - link:exec.html#simple[単純コマンドの実行]時、コマンドが見つからなくても link:params.html#sv-command_not_found_handler[+COMMAND_NOT_FOUND_HANDLER+ 変数]の値は実行しません。 |
31 | 34 | - link:exec.html#search[コマンドの検索]において{zwsp}link:builtin.html#types[通常の組込みコマンド]は対応する外部コマンドがないと見つかりません。 |
32 | -- いくつかの{zwsp}link:builtin.html[組込みコマンド]で特定のオプションが使えなくなるなど挙動が変わります。 | |
35 | +- いくつかの{zwsp}link:builtin.html[組込みコマンド]で特定のオプションが使えなくなるなど挙動が変わります。特に、長いオプションは使えなくなります。 | |
33 | 36 | - link:interact.html[対話モード]でないとき、{zwsp}link:builtin.html#types[特殊組込みコマンド]のオプションやオペランドの使い方が間違っているとシェルは直ちに終了します。また特殊組込みコマンドで代入エラーやリダイレクトエラーが発生したときも直ちに終了します。 |
34 | 37 | - link:interact.html[対話モード]のプロンプトを出す前に link:params.html#sv-prompt_command[+PROMPT_COMMAND+ 変数]の値を実行しません。{zwsp}link:params.html#sv-ps1[+PS1+ 変数]・{zwsp}link:params.html#sv-ps2[+PS2+ 変数]・{zwsp}link:params.html#sv-ps4[+PS4+ 変数]の値の解釈の仕方が違います。{zwsp}link:params.html#sv-yash_ps1[+YASH_PS1+] など +YASH_+ で始まる名前のプロンプト変数は使用されません。 |
35 | 38 | - link:interact.html#mailcheck[メールチェック]において、ファイルが更新されている場合はファイルが空でも新着メールメッセージを出力します。 |
@@ -29,6 +29,9 @@ | ||
29 | 29 | When the POSIXly-correct mode is enabled: |
30 | 30 | |
31 | 31 | - Different link:invoke.html#init[initialization scripts] are used. |
32 | +- If the shell was started with the link:invoke.html#arguments[+-c+ option], | |
33 | + +sh -c+ (instead of +yash -c+) is printed as the script pathname on a syntax | |
34 | + error. | |
32 | 35 | - Global link:syntax.html#aliases[aliases] are not substituted. |
33 | 36 | - Nested commands in a link:syntax.html#compound[compound command] must not be |
34 | 37 | empty. |
@@ -36,6 +39,8 @@ | ||
36 | 39 | variable rather than a local. The variable must have a portable (ASCII-only) |
37 | 40 | name. |
38 | 41 | - The first pattern in a link:syntax.html#case[case command] cannot be +esac+. |
42 | +- The +!+ keyword cannot be followed by +(+ without any whitespaces | |
43 | + in-between. | |
39 | 44 | - The +function+ keyword cannot be used for link:syntax.html#funcdef[function |
40 | 45 | definition]. The function must have a portable (ASCII-only) name. |
41 | 46 | - link:syntax.html#simple[Simple commands] cannot assign to |
@@ -47,7 +52,8 @@ | ||
47 | 52 | - link:expand.html#tilde[Tilde expansion] only expands +~+ and |
48 | 53 | +~{{username}}+. |
49 | 54 | - link:expand.html#params[Parameter expansion] cannot be nested. |
50 | - No link:expand.html#param-index[indexes] are allowed. | |
55 | + No link:expand.html#param-index[indexes] or | |
56 | + link:expand.html#param-mod[modifiers] with {{word2}} are allowed. | |
51 | 57 | - The commands in a link:expand.html#cmdsub[command substitution] of the form |
52 | 58 | +$({{commands}})+ are parsed every time the substitution is executed. |
53 | 59 | - In link:expand.html#arith[arithmetic expansion], fractional numbers and the |
@@ -61,6 +67,9 @@ | ||
61 | 67 | link:expand.html#glob[pathname expansion] yielded more than one or no |
62 | 68 | pathname, it is not immediately treated as an error. Instead, the shell |
63 | 69 | tries to treat the word before the expansion as a pathname. |
70 | +- A file descriptor must be readable and writable when duplicated by the | |
71 | + +<&+ and +>&+ link:redir.html#dup[redirection] operator, | |
72 | + respectively. | |
64 | 73 | - link:redir.html#socket[Socket redirection], link:redir.html#here[here |
65 | 74 | strings], link:redir.html#pipe[pipe redirection], and |
66 | 75 | link:redir.html#process[process redirection] cannot be used. |
@@ -72,7 +81,8 @@ | ||
72 | 81 | built-in] needs to have a corresponding external command for the built-in to |
73 | 82 | be found. |
74 | 83 | - Some link:builtin.html[built-ins] behave differently. |
75 | - Especially, some command-line options cannot be used. | |
84 | + Especially, long command-line options (as well as some others) cannot be | |
85 | + used. | |
76 | 86 | - A link:interact.html[non-interactive] shell exits when a |
77 | 87 | link:builtin.html#types[special built-in] is given a syntactically wrong |
78 | 88 | arguments or when an error occurs in assignment or redirection with a |