3 .\"O Expansion is performed on the command line after it has been split into
4 .\"O words. There are seven kinds of expansion performed:
5 .\"O .IR "brace expansion" ,
6 .\"O .IR "tilde expansion" ,
7 .\"O .IR "parameter and variable expansion" ,
8 .\"O .IR "command substitution" ,
9 .\"O .IR "arithmetic expansion" ,
10 .\"O .IR "word splitting" ,
12 .\"O .IR "pathname expansion" .
13 Ÿ³«¤Ï¥³¥Þ¥ó¥É¥é¥¤¥ó¾å¤Ç¡¢Ã±¸ì¤Ø¤Îʬ³ä¤Î¸å¤Ë¹Ô¤ï¤ì¤Þ¤¹¡£¹Ô¤ï¤ì¤ëŸ³«¤Ï
15 .IR "¥Ö¥ì¡¼¥¹¤ÎŸ³« (brace expansion)" ,
16 .IR "¥Á¥ë¥À¤ÎŸ³« (tilde expansion)" ,
17 .IR "¥Ñ¥é¥á¡¼¥¿¤ÈÊÑ¿ô¤ÎŸ³« (parameter and variable expansion)" ,
18 .IR "¥³¥Þ¥ó¥ÉÃÖ´¹ (command substitution)" ,
19 .IR "»»½Ñ¼°Å¸³« (arithmetic expansion)" ,
20 .IR "ñ¸ì¤Îʬ³ä (word splitting)" ,
21 .IR "¥Ñ¥¹Ì¾¤ÎŸ³« (pathname expansion)" ¡£
23 .\"O The order of expansions is: brace expansion, tilde expansion,
24 .\"O parameter, variable and arithmetic expansion and
25 .\"O command substitution
26 .\"O (done in a left-to-right fashion), word splitting, and pathname
28 Ÿ³«¤Î½ç½ø¤Ï¼¡¤Î¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹: ¥Ö¥ì¡¼¥¹Å¸³«¡¢¥Á¥ë¥ÀŸ³«¡¢¥Ñ¥é¥á¡¼¥¿¡¦
29 ÊÑ¿ô¡¦»»½Ñ¼°Å¸³«¡¢¥³¥Þ¥ó¥ÉÃÖ´¹ (º¸¤«¤é±¦¤Ø)¡¢Ã±¸ìʬ³ä¡¢¥Ñ¥¹Ì¾Å¸³«¡£
31 .\"O On systems that can support it, there is an additional expansion
32 .\"O available: \fIprocess substitution\fP.
33 ¤³¤ì¤é¤Ë²Ã¤¨¤Æ \fI¥×¥í¥»¥¹ÃÖ´¹ (process substitution)\fP ¤ò¥µ¥Ý¡¼¥È¤Ç¤
34 ¤ë¥·¥¹¥Æ¥à¤â¤¢¤ê¤Þ¤¹¡£
36 .\"O Only brace expansion, word splitting, and pathname expansion
37 .\"O can change the number of words of the expansion; other expansions
38 .\"O expand a single word to a single word.
39 .\"O The only exceptions to this are the expansions of
40 .\"O "\fB$@\fP" and "\fB${\fP\fIname\fP\fB[@]}\fP"
41 .\"O as explained above (see
43 .\"O .BR PARAMETERS ).
44 Ÿ³«¤·¤¿Éôʬ¤Îñ¸ì¤Î¿ô¤¬ÊѲ½¤¹¤ë¤³¤È¤¬¤¢¤ë¤Î¤Ï¡¢¥Ö¥ì¡¼¥¹Å¸³«¡¢Ã±¸ì¤Î
45 ʬ³ä¡¢¥Ñ¥¹Ì¾Å¸³«¤À¤±¤Ç¤¹¡£Â¾¤ÎŸ³«¤Ç¤Ï¡¢1 ¤Ä¤Îñ¸ì¤Ï 1 ¤Ä¤Îñ¸ì¤ËŸ³«
46 ¤µ¤ì¤Þ¤¹¡£¤³¤Îµ¬Â§¤ÎÍ£°ì¤ÎÎã³°¤ÏÀè¤ËÀâÌÀ¤·¤¿
47 "\fB$@\fP" ¤È "\fB${\fP\fIname\fP\fB[@]}\fP" ¤ÎŸ³« (
51 .\"O .SS Brace Expansion
54 .\"O .I "Brace expansion"
55 .\"O is a mechanism by which arbitrary strings
56 .\"O may be generated. This mechanism is similar to
57 .\"O \fIpathname expansion\fP, but the filenames generated
58 .\"O need not exist. Patterns to be brace expanded take
59 .\"O the form of an optional
61 .\"O followed by a series of comma-separated strings
62 .\"O between a pair of braces, followed by an optional
64 .\"O The preamble is prefixed to each string contained
65 .\"O within the braces, and the postscript is then appended
66 .\"O to each resulting string, expanding left to right.
67 .I "¥Ö¥ì¡¼¥¹Å¸³« (brace expansion)"
68 ¤Ï¡¢Ç¤°Õ¤Îʸ»úÎó¤òÀ¸À®¤¹¤ë¤³¤È¤¬¤Ç¤¤ëµ¡¹½¤Ç¤¹¡£¤³¤Îµ¡¹½¤Ï
69 \fI¥Ñ¥¹Ì¾Å¸³«\fP¤Ë»÷¤Æ¤¤¤Þ¤¹¤¬¡¢À¸À®¤µ¤ì¤¿¥Õ¥¡¥¤¥ë̾¤¬¼Âºß¤¹¤ëɬÍפϤ¢
70 ¤ê¤Þ¤»¤ó¡£Å¸³«¤µ¤ì¤ë¥Ö¥ì¡¼¥¹¤Ë¤Ê¤ë¥Ñ¥¿¡¼¥ó¤Ï¡¢
72 .IR "Á°ÃÖÉôʬ (preamble)" ¡¢
73 ÂФˤʤë¥Ö¥ì¡¼¥¹¤Î´Ö¤Ë¥³¥ó¥Þ¤Ç¶èÀڤäÆʤ٤¿Ê¸»úÎó¡¢
75 .I ¸åÃÖÉôʬ (postscript)
76 ¤ò½ç¤Ëʤ٤¿¤â¤Î¤Ç¤¹¡£Á°ÃÖÉôʬ¤Ï¥Ö¥ì¡¼¥¹Æâ¤Ë¤¢¤ëʸ»úÎ󤽤줾¤ì¤ÎÀèƬÉô
77 ʬ¤ËÄɲ䵤졢¸åÃÖÉôʬ¤Ïº¸¤«¤é±¦¤Ë½ç¤ËŸ³«¤µ¤ì¤ÆÆÀ¤é¤ì¤¿¤½¤ì¤¾¤ì¤Îʸ»úÎó
78 ¤ÎËöÈø¤ËÄɲ䵤ì¤Þ¤¹¡£
80 .\"O Brace expansions may be nested. The results of each expanded
81 .\"O string are not sorted; left to right order is preserved.
82 .\"O For example, a\fB{\fPd,c,b\fB}\fPe expands into `ade ace abe'.
83 ¥Ö¥ì¡¼¥¹¤ÎŸ³«¤ÏÆþ¤ì»Ò¤Ë¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£Å¸³«¤·¤ÆÆÀ¤é¤ì¤¿Ê¸»úÎó¤Ï¥½¡¼
84 ¥È¤µ¤ì¤º¡¢º¸¤«¤é±¦¤Ø¤Î½çÈÖ¤¬¤½¤Î¤Þ¤Þ»Ä¤ê¤Þ¤¹¡£Î㤨¤Ð¡¢
85 a\fB{\fPd,c,b\fB}\fPe ¤Ï `ade ace abe' ¤ÈŸ³«¤µ¤ì¤Þ¤¹¡£
87 .\"O Brace expansion is performed before any other expansions,
88 .\"O and any characters special to other expansions are preserved
89 .\"O in the result. It is strictly textual.
91 .\"O does not apply any syntactic interpretation to the context of the
92 .\"O expansion or the text between the braces.
93 ¥Ö¥ì¡¼¥¹¤ÎŸ³«¤Ï¾¤Î¤É¤ÎŸ³«¤è¤ê¤âÁ°¤Ë¼Â¹Ô¤µ¤ì¤Þ¤¹¡£¤Þ¤¿¡¢Â¾¤ÎŸ³«¤Ë¤ª
94 ¤¤¤ÆÆüì¤Ê°ÕÌ£¤ò»ý¤Äʸ»ú¤â¤½¤Î¤Þ¤Þ·ë²Ì¤Ë»Ä¤ê¤Þ¤¹¡£¤Ä¤Þ¤ê¡¢¸·Ì©¤Ë¥Æ¥¥¹
95 ¥ÈÁàºî¤À¤±¤ò¹Ô¤¤¤Þ¤¹¡£
97 ¤Ï¡¢Å¸³«¤Îʸ̮¤ä¥Ö¥ì¡¼¥¹¤Î´Ö¤Î¥Æ¥¥¹¥È¤ËÂФ·¤ÆʸˡŪ¤Ê²ò¼á¤òŬÍѤ¹¤ë¤³
100 .\"O A correctly-formed brace expansion must contain unquoted opening
101 .\"O and closing braces, and at least one unquoted comma.
102 .\"O Any incorrectly formed brace expansion is left unchanged.
103 .\"O A \fB{\fP or \fB,\fP may be quoted with a backslash to prevent its
104 .\"O being considered part of a brace expression.
105 Àµ¤·¤¤·Á¤Î¥Ö¥ì¡¼¥¹Å¸³«¤Ë¤Ï¡¢¥¯¥©¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤³«¤¥Ö¥ì¡¼¥¹¤ÈÊĤ¸¥Ö¥ì¡¼
106 ¥¹¡¢¤Þ¤¿¾¯¤Ê¤¯¤È¤â 1 ¤Ä¤Î¥¯¥©¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¥³¥ó¥Þ¤¬´Þ¤Þ¤ì¤Æ¤¤¤Ê¤±¤ì
107 ¤Ð¤Ê¤ê¤Þ¤»¤ó¡£Àµ¤·¤¤·Á¤Ç¤Ê¤¤¥Ö¥ì¡¼¥¹Å¸³«¤ÏÁ´¤Æ¡¢Êѹ¹¤µ¤ì¤Ê¤¤¤Ç¤½¤Î¤Þ¤Þ
108 »Ä¤ê¤Þ¤¹¡£\fB{\fP ¤ä \fB,\fP ¤ò¥Ð¥Ã¥¯¥¹¥é¥Ã¥·¥å¤Ç¥¯¥©¡¼¥È¤¹¤ì¤Ð¡¢¥Ö¥ì¡¼
109 ¥¹Å¸³«¤Î°ìÉô¤È²ò¼á¤µ¤ì¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
110 .\"O To avoid conflicts with parameter expansion, the string \fB${\fP
111 .\"O is not considered eligible for brace expansion.
112 ¥Ñ¥é¥á¡¼¥¿Å¸³«¤È¤Î¾×ÆͤòÈò¤±¤ë¤¿¤á¡¢Ê¸»úÎó \fB${\fP
113 ¤Ï¥Ö¥ì¡¼¥¹Å¸³«¤ÎÂоݤȤϲò¼á¤µ¤ì¤Þ¤»¤ó¡£
115 .\"O This construct is typically used as shorthand when the common
116 .\"O prefix of the strings to be generated is longer than in the
118 ¤³¤Î»ÅÁȤߤϡ¢À¸À®¤µ¤ì¤ëʸ»úÎó¤Î¶¦ÄÌÀèƬÉôʬ¤¬¡¢¾åµ¤ÎÎã¤è¤êŤ¤¾ì¹ç
119 ¤Ë¡¢Ã»½Ìɽ¸½¤È¤·¤Æ¤è¤¯»ÈÍѤµ¤ì¤Þ¤¹:
122 mkdir /usr/local/src/bash/{old,new,dist,bugs}
127 chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}
130 .\"O Brace expansion introduces a slight incompatibility with
131 .\"O historical versions of
134 .\"O does not treat opening or closing braces specially when they
135 .\"O appear as part of a word, and preserves them in the output.
136 ¥Ö¥ì¡¼¥¹Å¸³«¤ÎƳÆþ¤Ë¤è¤Ã¤Æ¡¢ÅÁÅýŪ¤Ê
138 ¤È¤Ï¾¯¤·Èó¸ß´¹¤Ë¤Ê¤Ã¤¿Éôʬ¤¬¤¢¤ê¤Þ¤¹¡£
140 ¤Ïñ¸ì¤Î°ìÉô¤È¤·¤Æ³«¤¥Ö¥ì¡¼¥¹¤äÊĤ¸¥Ö¥ì¡¼¥¹¤¬¸½¤ï¤ì¤Æ¤âÆÃÊÌ°·¤¤¤Ï¤»¤º¡¢
141 ¤½¤Î¤Þ¤Þ½ÐÎϤ˻Ĥ·¤Þ¤¹¡£
143 .\"O removes braces from words as a consequence of brace
144 .\"O expansion. For example, a word entered to
146 .\"O as \fIfile{1,2}\fP
147 .\"O appears identically in the output. The same word is
150 .\"O after expansion by
153 ¤Ï¥Ö¥ì¡¼¥¹Å¸³«¤Î·ë²Ì¤È¤·¤Æñ¸ì¤«¤é¥Ö¥ì¡¼¥¹¤ò¼è¤ê½ü¤¤Þ¤¹¡£Î㤨¤Ð¡¢
155 ¤Ë \fIfile{1,2}\fP ¤Î¤è¤¦¤ËÆþÎϤµ¤ì¤¿Ã±¸ì¤Ï¡¢¤½¤Î¤Þ¤Þ¤Î·Á¤Ç½ÐÎϤµ¤ì¤Þ
158 ¤Î¾ì¹ç¤Ë¤Ï¡¢¤³¤ì¤ÈƱ¤¸Ã±¸ì¤ÏŸ³«¤µ¤ì¤Æ
160 ¤Î¤è¤¦¤Ë½ÐÎϤµ¤ì¤Þ¤¹¡£
161 .\"O If strict compatibility with
163 .\"O is desired, start
167 .\"O option or disable brace expansion with the
173 .\"O .B SHELL BUILTIN COMMANDS
181 ¥ª¥×¥·¥ç¥ó¤òÉÕ¤±¤Æµ¯Æ°¤¹¤ë¤«¡¢
185 ¤ò»ØÄꤷ¤Æ¥Ö¥ì¡¼¥¹Å¸³«¤ò̵¸ú¤Ë¤·¤Æ¤¯¤À¤µ¤¤
188 .B ¥·¥§¥ëÁȤ߹þ¤ß¥³¥Þ¥ó¥É
190 .\"O .SS Tilde Expansion
193 .\"O If a word begins with an unquoted tilde character (`\fB~\fP'), all of
194 .\"O the characters preceding the first unquoted slash (or all characters,
195 .\"O if there is no unquoted slash) are considered a \fItilde-prefix\fP.
196 ¥¯¥©¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¥Á¥ë¥À (`\fB~\fP') ¤Çñ¸ì¤¬»Ï¤Þ¤Ã¤¿¾ì¹ç¡¢¥¯¥©¡¼¥È¤µ
197 ¤ì¤Æ¤¤¤Ê¤¤¥¹¥é¥Ã¥·¥å¤è¤ê¤âÁ°¤Ë¤¢¤ëʸ»ú¤¹¤Ù¤Æ (¥¯¥©¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¥¹¥é¥Ã
198 ¥·¥å¤¬Ìµ¤±¤ì¤Ð¤¹¤Ù¤Æ¤Îʸ»ú) ¤Ï¥Á¥ë¥À¥×¥ì¥Õ¥£¥Ã¥¯¥¹ (\fItilde-prefix\fP) ¤È
200 .\"O If none of the characters in the tilde-prefix are quoted, the
201 .\"O characters in the tilde-prefix following the tilde are treated as a
202 .\"O possible \fIlogin name\fP.
203 .\"O If this login name is the null string, the tilde is replaced with the
204 .\"O value of the shell parameter
207 ¥¯¥©¡¼¥È¤µ¤ì¤Æ¤¤¤ëʸ»ú¤¬¥Á¥ë¥À¥×¥ì¥Õ¥£¥Ã¥¯¥¹Ãæ¤Ë̵¤±¤ì¤Ð¡¢
208 ¥Á¥ë¥À¥×¥ì¥Õ¥£¥Ã¥¯¥¹Ãæ¤Î¥Á¥ë¥À°Ê¹ß¤Îʸ»ú¤Ï¡¢\fI¥í¥°¥¤¥ó̾ (login
209 name)\fP ¤Ë¤Ê¤ë²ÄǽÀ¤¬¤¢¤ëʸ»úÎó¤È¤·¤Æ°·¤ï¤ì¤Þ¤¹¡£¤³¤Î¥í¥°¥¤¥ó̾¤¬
210 ¶õʸ»úÎó¤Ê¤é¤Ð¡¢¥Á¥ë¥À¤Ï¥·¥§¥ë¥Ñ¥é¥á¡¼¥¿
213 ¤ÎÃͤËÃÖ¤´¹¤¨¤é¤ì¤Þ¤¹¡£
217 .\"O is unset, the home directory of the user executing the shell is
218 .\"O substituted instead.
219 .\"O Otherwise, the tilde-prefix is replaced with the home directory
220 .\"O associated with the specified login name.
223 ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¡¢Âå¤ï¤ê¤Ë¥·¥§¥ë¤ò¼Â¹Ô¤·¤Æ¤¤¤ë¥æ¡¼¥¶¤Î¥Û¡¼
224 ¥à¥Ç¥£¥ì¥¯¥È¥ê¤ËÃÖ¤´¹¤¨¤é¤ì¤Þ¤¹¡£¤½¤¦¤Ç¤Ê¤¤¾ì¹ç¤Ï¡¢¥Á¥ë¥À¥×¥ì¥Õ¥£¥Ã¥¯
225 ¥¹¤Ï»ØÄꤵ¤ì¤¿¥í¥°¥¤¥ó̾¤ËÂбþ¤¹¤ë¥Û¡¼¥à¥Ç¥£¥ì¥¯¥È¥ê¤ËÃÖ¤´¹¤¨¤é¤ì¤Þ¤¹¡£
227 .\"O If the tilde-prefix is a `~+', the value of the shell variable
230 .\"O replaces the tilde-prefix.
231 ¥Á¥ë¥À¥×¥ì¥Õ¥£¥Ã¥¯¥¹¤¬ `~+' ¤Ê¤é¤Ð¡¢¥Á¥ë¥À¥×¥ì¥Õ¥£¥Ã¥¯¥¹¤Ï¥·¥§¥ëÊÑ¿ô
234 ¤ÎÃͤËÃÖ¤´¹¤¨¤é¤ì¤Þ¤¹¡£
235 .\"O If the tilde-prefix is a `~\-', the value of the shell variable
238 .\"O if it is set, is substituted.
239 ¥Á¥ë¥À¥×¥ì¥Õ¥£¥Ã¥¯¥¹¤¬ `~\-' ¤Ê¤é¤Ð¡¢¥·¥§¥ëÊÑ¿ô
242 ¤ÎÃͤËÃÖ¤´¹¤¨¤é¤ì¤Þ¤¹ (Ãͤ¬ÀßÄꤵ¤ì¤Æ¤¤¤ì¤Ð)¡£
243 .\"O If the characters following the tilde in the tilde-prefix consist
244 .\"O of a number \fIN\fP, optionally prefixed
245 .\"O by a `+' or a `\-', the tilde-prefix is replaced with the corresponding
246 .\"O element from the directory stack, as it would be displayed by the
248 .\"O builtin invoked with the tilde-prefix as an argument.
249 .\"O If the characters following the tilde in the tilde-prefix consist of a
250 .\"O number without a leading `+' or `\-', `+' is assumed.
251 ¥Á¥ë¥À¥×¥ì¥Õ¥£¥Ã¥¯¥¹Ãæ¤Î¥Á¥ë¥À¤è¤ê¸å¤Îʸ»ú¤¬¿ôÃÍ \fIN\fP ¤Ç¤¢¤ì¤Ð (
252 ¿ôÃͤÎÁ°¤Ë `+' ¤ä `\-' ¤òÃÖ¤¯¤³¤È¤â¤Ç¤¤Þ¤¹)¡¢¥Á¥ë¥À¥×¥ì¥Õ¥£¥Ã¥¯¥¹¤Ï¥Ç¥£
253 ¥ì¥¯¥È¥ê¥¹¥¿¥Ã¥¯Æâ¤ÎÂбþ¤¹¤ëÍ×ÁǤËÃÖ´¹¤µ¤ì¤Þ¤¹¡£
254 ÃÖ´¹¤µ¤ì¤ëÍ×ÁǤϡ¢¥Á¥ë¥À¥×¥ì¥Õ¥£¥Ã¥¯¥¹¤ò°ú¤¿ô¤È¤·¤ÆÁȤ߹þ¤ß¥³¥Þ¥ó¥É
256 ¤ò¼Â¹Ô¤·¤¿¤È¤¤Ëɽ¼¨¤µ¤ì¤ë¤â¤Î¤Ç¤¹¡£
257 ¥Á¥ë¥À¥×¥ì¥Õ¥£¥Ã¥¯¥¹¤Ë¤ª¤±¤ë¥Á¥ë¥À°Ê¹ß¤Îʸ»ú¤¬¡¢Àè¹Ô¤¹¤ë `+' ¤ä `-' ¤Î¤Ê¤¤
258 ¿ôÃͤǤ¢¤ë¾ì¹ç¤Ï¡¢`+' ¤Ç¤¢¤ë¤È¤ß¤Ê¤µ¤ì¤Þ¤¹¡£
260 .\"O If the login name is invalid, or the tilde expansion fails, the word
262 ¥í¥°¥¤¥ó̾¤¬Í¸ú¤Ç¤Ê¤¤¾ì¹ç¤ä¡¢¥Á¥ë¥ÀŸ³«¤¬¼ºÇÔ¤·¤¿¾ì¹ç¤Ë¤Ï¡¢Ã±¸ì¤ÏÃÖ¤
265 .\"O Each variable assignment is checked for unquoted tilde-prefixes immediately
270 .\"O In these cases, tilde expansion is also performed.
271 Á´¤Æ¤ÎÊÑ¿ôÂåÆþ¤Ë¤ª¤¤¤Æ
275 ¤Îľ¸å¤Ë¤¢¤ë¥¯¥©¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¥Á¥ë¥À¥×¥ì¥Õ¥£¥Ã¥¯¥¹¤Î¥Á¥§¥Ã¥¯¤¬¹Ô¤ï¤ì
276 ¤Þ¤¹¡£¤â¤·¸«¤Ä¤«¤Ã¤¿¾ì¹ç¤Ë¤Ï¤³¤ì¤é¤â¥Á¥ë¥ÀŸ³«¤µ¤ì¤Þ¤¹¡£
277 .\"O Consequently, one may use file names with tildes in assignments to
285 .\"O and the shell assigns the expanded value.
293 ¤Ø¤ÎÂåÆþ¤Ë¥Á¥ë¥À¤ò´Þ¤à¥Õ¥¡¥¤¥ë̾¤ò»È¤¤¡¢Å¸³«¤µ¤ì¤¿Ãͤò¥·¥§¥ë¤ËÂåÆþ¤µ¤»
295 .\"O .SS Parameter Expansion
298 .\"O The `\fB$\fP' character introduces parameter expansion,
299 .\"O command substitution, or arithmetic expansion. The parameter name
300 .\"O or symbol to be expanded may be enclosed in braces, which
301 .\"O are optional but serve to protect the variable to be expanded from
302 .\"O characters immediately following it which could be
303 .\"O interpreted as part of the name.
304 `\fB$\fP' ʸ»ú¤¬¤¢¤ë¤È¡¢¥Ñ¥é¥á¡¼¥¿Å¸³«¡¢¥³¥Þ¥ó¥ÉÃÖ´¹¡¢»»½Ñ¼°Å¸³«¤¬¹Ô¤ï
305 ¤ì¤Þ¤¹¡£Å¸³«¤µ¤ì¤ë¥Ñ¥é¥á¡¼¥¿Ì¾¤ä¥·¥ó¥Ü¥ë¤Ï¡¢¥Ö¥ì¡¼¥¹¤Ç³ç¤ë¤³¤È¤â¤Ç¤¤Þ
306 ¤¹¡£¥Ö¥ì¡¼¥¹¤Ï¾Êά²Äǽ¤Ç¤¹¤¬¡¢ÊÑ¿ô¤Îľ¸å¤Ë¤¢¤ê¡¢¤½¤Î̾Á°¤Î°ìÉô¤È²ò¼á¤¹
307 ¤ë¤³¤È¤¬¤Ç¤¤ëʸ»ú¤È°ì½ï¤ËÊÑ¿ô¤¬Å¸³«¤µ¤ì¤ë¤³¤È¤òËɤ°ÊýË¡¤È¤·¤ÆÍÑ°Õ¤µ¤ì
310 .\"O When braces are used, the matching ending brace is the first `\fB}\fP'
311 .\"O not escaped by a backslash or within a quoted string, and not within an
312 .\"O embedded arithmetic expansion, command substitution, or paramter
314 ¥Ö¥ì¡¼¥¹¤ò»È¤Ã¤¿¾ì¹ç¡¢¥Þ¥Ã¥Á¥ó¥°¤ò½ª¤¨¤ë¥Ö¥ì¡¼¥¹¤ÏºÇ½é¤Î `\fB}\fP' ¤Ç
315 ¤¹¡£¤¿¤À¤·¡¢¥Ð¥Ã¥¯¥¹¥é¥Ã¥·¥å¤Ç¥¨¥¹¥±¡¼¥×¤µ¤ì¤Æ¤¤¤ë¤â¤Î¤ä¥¯¥©¡¼¥È¤µ¤ì¤Æ
316 ¤¤¤ëʸ»úÎóÃæ¤Î¤â¤Î¤Ï´Þ¤Þ¤ì¤Þ¤»¤ó¤·¡¢»»½Ñ¼°Å¸³«¤ä¥³¥Þ¥ó¥ÉÃÖ´¹¡¢¥Ñ¥é¥á¡¼
317 ¥¿Å¸³«¤ËÆþ¤Ã¤Æ¤¤¤ë¤â¤Î¤â´Þ¤Þ¤ì¤Þ¤»¤ó¡£
322 .\"O The value of \fIparameter\fP is substituted. The braces are required
325 .\"O is a positional parameter with more than one digit,
328 .\"O is followed by a character which is not to be
329 .\"O interpreted as part of its name.
330 \fIparameter\fP ¤ÎÃͤ¬ÃÖ´¹¤µ¤ì¤Þ¤¹¡£¥Ö¥ì¡¼¥¹¤¬É¬Íפˤʤë¤Î¤Ï¡¢
332 ¤¬ 2 ·å°Ê¾å¤Î¿ô»ú¤ò»ý¤Ä°ÌÃÖÉÕ¤¥Ñ¥é¥á¡¼¥¿¤Î¾ì¹ç¤ä¡¢
334 ¤Îľ¸å¤Îʸ»ú¤ò̾Á°¤Î°ìÉô¤È¤·¤Æ²ò¼á¤µ¤»¤¿¤¯¤Ê¤¤¾ì¹ç¤Ç¤¹¡£
337 .\"O If the first character of \fIparameter\fP is an exclamation point,
338 .\"O a level of variable indirection is introduced.
339 .\"O \fBBash\fP uses the value of the variable formed from the rest of
340 .\"O \fIparameter\fP as the name of the variable; this variable is then
341 .\"O expanded and that value is used in the rest of the substitution, rather
342 .\"O than the value of \fIparameter\fP itself.
343 .\"O This is known as \fIindirect expansion\fP.
344 \fIparameter\fP ¤ÎºÇ½é¤Îʸ»ú¤¬´¶Ã²Éä¤Ç¤¢¤ë¾ì¹ç¡¢´ÖÀÜÊÑ¿ô¥ì¥Ù¥ë
345 (level of variable indirection) ¤È¤¤¤¦³µÇ°¤¬Æ³Æþ¤µ¤ì¤Þ¤¹¡£\fBbash\fP ¤Ï¡¢
346 Ÿ³«¤Ë \fIparameter\fP ¤½¤Î¤â¤Î¤ÎÃͤò»ÈÍѤ¹¤ë¤Î¤Ç¤Ê¤¯¡¢
347 \fIparameter\fP ¤Î´¶Ã²Éä¤ò½ü¤¤¤¿»Ä¤ê¤Îʸ»ú¤òÊÑ¿ô̾¤È¤·¤Æ°·¤¤¡¢¤½¤ÎÊÑ¿ô
348 ¤ÎÃͤò¤½¤Î¸åŸ³«¤Ë»ÈÍѤ·¤Þ¤¹¡£¤³¤ì¤¬\fI´ÖÀÜŸ³« (indirect expansion)\fP
350 .\"O The exception to this is the expansion of ${!\fIprefix\fP*}
351 .\"O described below.
352 ¤¿¤À¤·Îã³°¤È¤·¤Æ¡¢°Ê²¼¤ÇÀâÌÀ¤¹¤ë ${!\fIprefix\fP*} ¤ÎŸ³«¤¬¤¢¤ê¤Þ¤¹¡£
354 .\"O In each of the cases below, \fIword\fP is subject to tilde expansion,
355 .\"O parameter expansion, command substitution, and arithmetic expansion.
356 .\"O When not performing substring expansion, \fBbash\fP tests for a parameter
357 .\"O that is unset or null; omitting the colon results in a test only for a
358 .\"O parameter that is unset.
359 °Ê²¼¤Ë¼¨¤¹¤½¤ì¤¾¤ì¤Î¾ì¹ç¡¢\fIword\fP ¤ËÂФ·¤Æ¥Á¥ë¥ÀŸ³«¡¢¥Ñ¥é¥á¡¼¥¿Å¸
360 ³«¡¢¥³¥Þ¥ó¥ÉÃÖ´¹¡¢»»½Ñ¼°Å¸³«¤¬¹Ô¤ï¤ì¤Þ¤¹¡£Éôʬʸ»úÎ󟳫°Ê³°¤Î¾ì¹ç¡¢
361 \fBbash\fP ¤Ï¥Ñ¥é¥á¡¼¥¿¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¤«¡¢¶õ¤Ç¤Ï¤Ê¤¤¤«¤òÄ´¤Ù¤Þ¤¹¡£¥³
362 ¥í¥ó¤ò¾Êά¤·¤¿¾ì¹ç¤Ë¤ÏÀßÄꤵ¤ì¤Æ¤¤¤ë¤«¤É¤¦¤«¤Î¤ß¤òÄ´¤Ù¤Þ¤¹¡£
366 ${\fIparameter\fP\fB:\-\fP\fIword\fP}
367 .\"O \fBUse Default Values\fP. If
369 .\"O is unset or null, the expansion of
371 .\"O is substituted. Otherwise, the value of
374 \fB¥Ç¥Õ¥©¥ë¥È¤ÎÃͤò»È¤¤¤Þ¤¹\fP¡£
376 ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¤«¶õʸ»úÎó¤Ç¤¢¤ì¤Ð¡¢
378 ¤òŸ³«¤·¤¿¤â¤Î¤ËÃÖ´¹¤µ¤ì¤Þ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð¡¢
382 ${\fIparameter\fP\fB:=\fP\fIword\fP}
383 .\"O \fBAssign Default Values\fP.
384 \fB¥Ç¥Õ¥©¥ë¥ÈÃͤòÂåÆþ¤·¤Þ¤¹\fP¡£
387 .\"O is unset or null, the expansion of
393 .\"O is then substituted. Positional parameters and special parameters may
394 .\"O not be assigned to in this way.
396 ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¤«¶õʸ»úÎó¤Ç¤¢¤ì¤Ð¡¢
400 ¤ËÂåÆþ¤µ¤ì¤Þ¤¹¡£¤½¤ì¤«¤é
402 ¤ÎÃͤؤÎÃÖ´¹¤¬¹Ô¤ï¤ì¤Þ¤¹¡£°ÌÃÖÉÕ¤¥Ñ¥é¥á¡¼¥¿¤äÆüì¥Ñ¥é¥á¡¼¥¿¤Ø¤ÎÂå
403 Æþ¤ò¤³¤Î¤è¤¦¤Ë¹Ô¤¦¤³¤È¤Ï¤Ç¤¤Þ¤»¤ó¡£
405 ${\fIparameter\fP\fB:?\fP\fIword\fP}
406 .\"O \fBDisplay Error if Null or Unset\fP.
407 \fB¶õʸ»úÎó¤Þ¤¿¤ÏÀßÄꤵ¤ì¤Æ¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¥¨¥é¡¼¤òɽ¼¨¤·¤Þ¤¹\fP¡£
410 .\"O is null or unset, the expansion of \fIword\fP (or a message to that effect
413 .\"O is not present) is written to the standard error and the shell, if it
414 .\"O is not interactive, exits. Otherwise, the value of \fIparameter\fP is
417 ¤¬¶õʸ»úÎó¤Þ¤¿¤ÏÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢\fIword\fP ¤òŸ³«¤·¤¿¤â¤Î (
419 ¤¬¤Ê¤±¤ì¤Ð¡¢¥Ñ¥é¥á¡¼¥¿¤¬¶õʸ»úÎó¤Þ¤¿¤ÏÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¤³¤È¤ò¼¨¤¹¥á¥Ã¥»¡¼
420 ¥¸) ¤¬É¸½à¥¨¥é¡¼½ÐÎϤ˽ÐÎϤµ¤ì¤Þ¤¹¡£¥·¥§¥ë¤¬ÂÐÏÃŪ¤Ç¤Ê¤±¤ì¤Ð¡¢¥·¥§¥ë¤Ï
421 ½ªÎ»¤·¤Þ¤¹¡£¥Ñ¥é¥á¡¼¥¿¤Ë¶õʸ»úÎó°Ê³°¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ì¤Ð¡¢
422 \fIparameter\fP ¤ÎÃͤؤÎÃÖ´¹¤¬¹Ô¤ï¤ì¤Þ¤¹¡£
424 ${\fIparameter\fP\fB:+\fP\fIword\fP}
425 .\"O \fBUse Alternate Value\fP.
426 \fBÊ̤ÎÃͤò»ÈÍѤ·¤Þ¤¹\fP¡£
429 .\"O is null or unset, nothing is substituted, otherwise the expansion of
433 ¤¬¶õʸ»úÎó¤Þ¤¿¤ÏÀßÄꤵ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¡¢¶õʸ»úÎó¤ËÃÖ´¹¤µ¤ì¤Þ¤¹¡£¤½¤¦¤Ç¤Ê
436 ¤òŸ³«¤·¤¿¤â¤Î¤ËÃÖ´¹¤µ¤ì¤Þ¤¹¡£
439 ${\fIparameter\fP\fB:\fP\fIoffset\fP}
441 ${\fIparameter\fP\fB:\fP\fIoffset\fP\fB:\fP\fIlength\fP}
443 .\"O \fBSubstring Expansion.\fP
444 \fBÉôʬʸ»úÎ󟳫\fP¡£
445 .\"O Expands to up to \fIlength\fP characters of \fIparameter\fP
446 .\"O starting at the character specified by \fIoffset\fP.
447 .\"O If \fIlength\fP is omitted, expands to the substring of
448 .\"O \fIparameter\fP, starting at the character specified by \fIoffset\fP.
449 .\"O \fIlength\fP and \fIoffset\fP are arithmetic expressions (see
452 .\"O ARITHMETIC EVALUATION
454 \fIparameter\fP ¤òŸ³«¤·¤¿¤â¤Î¤«¤éºÇÂç \fIlength\fP ʸ»ú¤ò¼è¤ê½Ð¤·¤Þ¤¹¡£
455 ÀèƬ¤Îʸ»ú¤Ï \fIoffset\fP ¤Ç»ØÄꤷ¤Þ¤¹¡£\fIlength\fP ¤ò¾Êά¤¹¤ë¤È¡¢
456 \fIoffset\fP ¤Ç»ØÄꤷ¤¿Ê¸»ú¤òÀèƬ¤Ë¤·¤Æ¡¢\fIparameter\fP ¤Î»Ä¤êÁ´Éô¤¬
457 ´Þ¤Þ¤ì¤ëÉôʬʸ»úÎó¤ËŸ³«¤·¤Þ¤¹¡£\fIlength\fP ¤È \fIoffset\fP ¤Ï»»½Ñ¼°
462 .\"O \fIlength\fP must evaluate to a number greater than or equal to zero.
463 .\"O If \fIoffset\fP evaluates to a number less than zero, the value
464 .\"O is used as an offset from the end of the value of \fIparameter\fP.
465 \fIlength\fP ¤Îɾ²Á·ë²Ì¤Ï 0 °Ê¾å¤Î¿ô¤Ç¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£
466 \fIoffset\fP ¤òɾ²Á¤¹¤ë¤È 0 ̤Ëþ¤Î¿ô¤Ë¤Ê¤ë¾ì¹ç¡¢¤³¤ÎÃͤÏ
467 \fIparameter\fP ¤ÎÃͤÎËöÈø¤«¤é¤Î¥ª¥Õ¥»¥Ã¥È¤È¤·¤Æ»È¤ï¤ì¤Þ¤¹¡£
468 .\"O If \fIparameter\fP is \fB@\fP, the result is \fIlength\fP positional
469 .\"O parameters beginning at \fIoffset\fP.
470 .\"O If \fIparameter\fP is an array name indexed by @ or *,
471 .\"O the result is the \fIlength\fP
472 .\"O members of the array beginning with ${\fIparameter\fP[\fIoffset\fP]}.
473 .\"O Substring indexing is zero-based unless the positional parameters
474 .\"O are used, in which case the indexing starts at 1.
475 \fIparameter\fP ¤¬ \fB@\fP ¤Ê¤é¤Ð¡¢·ë²Ì¤Ï \fIoffset\fP ¤«¤é»Ï¤Þ¤ë
476 \fIlength\fP ¸Ä¤Î°ÌÃÖÉÕ¤¥Ñ¥é¥á¡¼¥¿¤Ë¤Ê¤ê¤Þ¤¹¡£
477 \fIparameter\fP ¤¬ @ ¤Þ¤¿¤Ï * ¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹¤¬ÉÕ¤¤¤Æ¤¤¤ëÇÛÎó̾¤Ê¤é¤Ð¡¢
478 ·ë²Ì¤ÏÇÛÎó¤Î ${\fIparameter\fP[\fIoffset\fP]} ¤òÀèƬ¤È¤¹¤ëÍ×ÁÇ
479 \fIlength\fP ¸Ä¤È¤Ê¤ê¤Þ¤¹¡£°ÌÃÖÉÕ¤¥Ñ¥é¥á¡¼¥¿¤ò»È¤¦¾ì¹ç°Ê³°¤Ï¡¢Éôʬʸ
480 »úÎó¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹¤Ï 0 ¤«¤é»Ï¤Þ¤ê¤Þ¤¹¡£°ÌÃÖÉÕ¤¥Ñ¥é¥á¡¼¥¿¤Î¾ì¹ç¤Ë¤Ï¡¢
481 ¥¤¥ó¥Ç¥Ã¥¯¥¹¤Ï 1 ¤«¤é»Ï¤Þ¤ê¤Þ¤¹¡£
483 ${\fB!\fP\fIprefix\fP\fB*\fP}
484 .\"O Expands to the names of variables whose names begin with \fIprefix\fP,
485 .\"O separated by the first character of the
488 .\"O special variable.
489 \fIprefix\fP ¤Ç»Ï¤Þ¤ë¤¹¤Ù¤Æ¤ÎÊÑ¿ô¤Î̾Á°¤ËŸ³«¤·¤Æ¡¢
492 ÆüìÊÑ¿ô¤ÎºÇ½é¤Îʸ»ú¤Ë¤è¤Ã¤Æ¶èÀÚ¤ê¤Þ¤¹¡£
494 ${\fB#\fP\fIparameter\fP}
495 .\"O The length in characters of the value of \fIparameter\fP is substituted.
502 .\"O the value substituted is the number of positional parameters.
505 .\"O is an array name subscripted by
509 .\"O the value substituted is the number of elements in the array.
510 \fIparameter\fP ¤ÎÃͤ˴ޤޤì¤ëʸ»ú¿ô¤ËÃÖ´¹¤µ¤ì¤Þ¤¹¡£
516 ¤Ê¤é¤Ð¡¢°ÌÃÖÉÕ¤¥Ñ¥é¥á¡¼¥¿¤Î¿ô¤ËÃÖ´¹¤µ¤ì¤Þ¤¹¡£
522 ¤¬Åº»ú¤Ë¤Ê¤Ã¤Æ¤¤¤ëÇÛÎó̾¤Ê¤é¤Ð¡¢ÇÛÎóÃæ¤ÎÍ×ÁÇ¿ô¤ËÃÖ´¹¤µ¤ì¤Þ¤¹¡£
525 ${\fIparameter\fP\fB#\fP\fIword\fP}
527 ${\fIparameter\fP\fB##\fP\fIword\fP}
531 .\"O is expanded to produce a pattern just as in pathname
532 .\"O expansion. If the pattern matches the beginning of
535 .\"O then the result of the expansion is the expanded value of
537 .\"O with the shortest matching pattern (the ``\fB#\fP'' case) or the
538 .\"O longest matching pattern (the ``\fB##\fP'' case) deleted.
540 ¤¬Å¸³«¤µ¤ì¡¢¥Ñ¥¹Ì¾Å¸³«¤Î¾ì¹ç¤ÈƱ¤¸¤è¤¦¤Ê¥Ñ¥¿¡¼¥ó¤òºî¤ê¤Þ¤¹¡£¤³
543 ¤ÎÃͤÎÀèƬÉôʬ¤È¥Þ¥Ã¥Á¤¹¤ë¾ì¹ç¡¢Å¸³«¤·¤ÆÆÀ¤é¤ì¤ëÃͤÏ
545 ¤òŸ³«¤·¤¿Ãͤ«¤éºÇû°ìÃץѥ¿¡¼¥ó (``\fB#\fP''¤Î¾ì¹ç) ¤Þ¤¿¤ÏºÇĹ°ìÃץѥ¿¡¼
546 ¥ó (``\fB##\fP'' ¤Î¾ì¹ç) ¤ò¼è¤ê½ü¤¤¤¿¤â¤Î¤Ë¤Ê¤ê¤Þ¤¹¡£
553 .\"O the pattern removal operation is applied to each positional
554 .\"O parameter in turn, and the expansion is the resultant list.
560 ¤Ç¤¢¤ë¾ì¹ç¡¢¥Ñ¥¿¡¼¥ó¤òºï½ü¤¹¤ëÁàºî¤ÏÁ´¤Æ¤Î°ÌÃÖÉÕ¤¥Ñ¥é¥á¡¼¥¿¤Ë½çÈÖ¤ËŬ
561 ÍѤµ¤ì¡¢Å¸³«·ë²Ì¤Ï¥ê¥¹¥È¤È¤·¤ÆÆÀ¤é¤ì¤Þ¤¹¡£
564 .\"O is an array variable subscripted with
568 .\"O the pattern removal operation is applied to each member of the
569 .\"O array in turn, and the expansion is the resultant list.
575 ¤¬Åº»ú¤Ë¤Ê¤Ã¤Æ¤¤¤ëÇÛÎóÊÑ¿ô¤Ç¤¢¤ë¾ì¹ç¡¢¥Ñ¥¿¡¼¥ó¤òºï½ü¤¹¤ëÁàºî¤ÏÇÛÎó¤ÎÁ´
576 ¤Æ¤ÎÍ×ÁǤ˽çÈÖ¤ËŬÍѤµ¤ì¡¢Å¸³«·ë²Ì¤Ï¥ê¥¹¥È¤È¤·¤ÆÆÀ¤é¤ì¤Þ¤¹¡£
579 ${\fIparameter\fP\fB%\fP\fIword\fP}
581 ${\fIparameter\fP\fB%%\fP\fIword\fP}
583 .\"O The \fIword\fP is expanded to produce a pattern just as in
584 .\"O pathname expansion.
585 .\"O If the pattern matches a trailing portion of the expanded value of
587 .\"O then the result of the expansion is the expanded value of
589 .\"O with the shortest matching pattern (the ``\fB%\fP'' case) or the
590 .\"O longest matching pattern (the ``\fB%%\fP'' case) deleted.
592 ¤¬Å¸³«¤µ¤ì¡¢¥Ñ¥¹Ì¾Å¸³«¤Î¾ì¹ç¤ÈƱ¤¸¤è¤¦¤Ê¥Ñ¥¿¡¼¥ó¤òºî¤ê¤Þ¤¹¡£¤³
595 ¤òŸ³«¤·¤¿ÃͤÎËöÈø¤ÎÉôʬ¤È¥Þ¥Ã¥Á¤¹¤ë¾ì¹ç¡¢Å¸³«·ë²Ì¤Ï
597 ¤òŸ³«¤·¤¿Ãͤ«¤éºÇû°ìÃץѥ¿¡¼¥ó (``\fB%\fP'' ¤Î¾ì¹ç) ¤Þ¤¿¤ÏºÇĹ°ìÃץѥ¿¡¼
598 ¥ó (``\fB%%\fP'' ¤Î¾ì¹ç) ¤ò¼è¤ê½ü¤¤¤¿¤â¤Î¤Ë¤Ê¤ê¤Þ¤¹¡£
605 .\"O the pattern removal operation is applied to each positional
606 .\"O parameter in turn, and the expansion is the resultant list.
612 ¤Ç¤¢¤ë¾ì¹ç¡¢¥Ñ¥¿¡¼¥ó¤òºï½ü¤¹¤ëÁàºî¤ÏÁ´¤Æ¤Î°ÌÃÖÉÕ¤¥Ñ¥é¥á¡¼¥¿¤Ë½çÈÖ¤ËŬ
613 ÍѤµ¤ì¡¢Å¸³«·ë²Ì¤Ï¥ê¥¹¥È¤È¤·¤ÆÆÀ¤é¤ì¤Þ¤¹¡£
616 .\"O is an array variable subscripted with
620 .\"O the pattern removal operation is applied to each member of the
621 .\"O array in turn, and the expansion is the resultant list.
627 ¤¬Åº»ú¤Ë¤Ê¤Ã¤Æ¤¤¤ëÇÛÎóÊÑ¿ô¤Ç¤¢¤ë¾ì¹ç¡¢¥Ñ¥¿¡¼¥ó¤òºï½ü¤¹¤ëÁàºî¤ÏÇÛÎó¤ÎÁ´
628 ¤Æ¤ÎÍ×ÁǤ˽çÈÖ¤ËŬÍѤµ¤ì¡¢Å¸³«·ë²Ì¤Ï¥ê¥¹¥È¤È¤·¤ÆÆÀ¤é¤ì¤Þ¤¹¡£
631 ${\fIparameter\fP\fB/\fP\fIpattern\fP\fB/\fP\fIstring\fP}
633 ${\fIparameter\fP\fB//\fP\fIpattern\fP\fB/\fP\fIstring\fP}
635 .\"O The \fIpattern\fP is expanded to produce a pattern just as in
636 .\"O pathname expansion.
637 \fIpattern\fP ¤¬Å¸³«¤µ¤ì¡¢¥Ñ¥¹Ì¾Å¸³«¤Î¾ì¹ç¤ÈƱ¤¸¤è¤¦¤Ê¥Ñ¥¿¡¼¥ó
639 .\"O \fIParameter\fP is expanded and the longest match of \fIpattern\fP
640 .\"O against its value is replaced with \fIstring\fP.
641 \fIparameter\fP ¤ÎŸ³«¤¬¹Ô¤ï¤ì¡¢¤½¤ÎÃͤΤ¦¤Á \fIpattern\fP ¤ËºÇĹ°ìÃ×
642 ¤¹¤ëÉôʬ¤¬ \fIstring\fP ¤ËÃÖ´¹¤µ¤ì¤Þ¤¹¡£
643 .\"O In the first form, only the first match is replaced.
644 Á°¼Ô¤Î·Á¼°¤Î¾ì¹ç¤Ë¤Ï¡¢ºÇ½é¤Ë¥Þ¥Ã¥Á¤·¤¿Éôʬ¤À¤±¤¬ÃÖ´¹¤µ¤ì¤Þ¤¹¡£
645 .\"O The second form causes all matches of \fIpattern\fP to be
646 .\"O replaced with \fIstring\fP.
647 ¸å¼Ô¤Î·Á¼°¤Î¾ì¹ç¤Ë¤Ï¡¢¥Þ¥Ã¥Á¤·¤¿Éôʬ¤ÏÁ´¤Æ \fIstring\fP ¤ËÃÖ´¹¤µ¤ì¤Þ¤¹¡£
648 .\"O If \fIpattern\fP begins with \fB#\fP, it must match at the beginning
649 .\"O of the expanded value of \fIparameter\fP.
650 \fIpattern\fP ¤¬ \fB#\fP ¤Ç»Ï¤Þ¤ë¾ì¹ç¤Ë¤Ï¡¢¥Ñ¥¿¡¼¥ó¤Ï \fIparameter\fP
651 ¤òŸ³«¤·¤¿ÃͤÎÀèƬ¤Ë¥Þ¥Ã¥Á¤·¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£
652 .\"O If \fIpattern\fP begins with \fB%\fP, it must match at the end
653 .\"O of the expanded value of \fIparameter\fP.
654 \fIpattern\fP ¤¬ \fB%\fP ¤Ç»Ï¤Þ¤ë¾ì¹ç¤Ë¤Ï¡¢¥Ñ¥¿¡¼¥ó¤Ï \fIparameter\fP
655 ¤òŸ³«¤·¤¿ÃͤÎËöÈø¤Ë¥Þ¥Ã¥Á¤·¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£
656 .\"O If \fIstring\fP is null, matches of \fIpattern\fP are deleted
657 .\"O and the \fB/\fP following \fIpattern\fP may be omitted.
658 \fIstring\fP ¤¬¶õ¤Î¾ì¹ç¤Ë¤Ï \fIpattern\fP ¤Ë¥Þ¥Ã¥Á¤·¤¿Éôʬ¤Ïºï½ü¤µ¤ì¤Þ
659 ¤¹¡£¤Þ¤¿¤³¤Î¾ì¹ç¤Ë¤Ï¡¢\fIpattern\fP ¤Î¸å¤Ë³¤¯ \fB/\fP ¤Ï¾Êά²Äǽ¤Ç¤¹¡£
666 .\"O the substitution operation is applied to each positional
667 .\"O parameter in turn, and the expansion is the resultant list.
673 ¤Ç¤¢¤ë¾ì¹ç¡¢ÃÖ´¹Áàºî¤ÏÁ´¤Æ¤Î°ÌÃÖÉÕ¤¥Ñ¥é¥á¡¼¥¿¤Ë½çÈÖ¤ËŬÍѤµ¤ì¡¢Å¸³«·ë
674 ²Ì¤Ï¥ê¥¹¥È¤È¤·¤ÆÆÀ¤é¤ì¤Þ¤¹¡£
677 .\"O is an array variable subscripted with
681 .\"O the substitution operation is applied to each member of the
682 .\"O array in turn, and the expansion is the resultant list.
688 ¤¬Åº»ú¤Ë¤Ê¤Ã¤Æ¤¤¤ëÇÛÎóÊÑ¿ô¤Ç¤¢¤ë¾ì¹ç¡¢ÃÖ´¹Áàºî¤ÏÇÛÎó¤ÎÁ´¤Æ¤ÎÍ×ÁǤ˽çÈÖ
689 ¤ËŬÍѤµ¤ì¡¢Å¸³«·ë²Ì¤Ï¥ê¥¹¥È¤È¤·¤ÆÆÀ¤é¤ì¤Þ¤¹¡£
690 .\"O .SS Command Substitution
693 .\"O \fICommand substitution\fP allows the output of a command to replace
694 .\"O the command name. There are two forms:
695 \fI¥³¥Þ¥ó¥ÉÃÖ´¹ (command substitution)\fP ¤òÍѤ¤¤ë¤È¡¢¥³¥Þ¥ó¥É̾¤ò¥³¥Þ¥ó
696 ¥É¤Î½ÐÎϤÇÃÖ¤´¹¤¨¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£¥³¥Þ¥ó¥ÉÃÖ´¹¤Ë¤Ï°Ê²¼¤Î 2 ¤Ä¤Î·Á¼°
701 \fB$(\fP\fIcommand\fP\|\fB)\fP
706 \fB`\fP\fIcommand\fP\fB`\fP
710 .\"O performs the expansion by executing \fIcommand\fP and
711 .\"O replacing the command substitution with the standard output of the
712 .\"O command, with any trailing newlines deleted.
713 .\"O Embedded newlines are not deleted, but they may be removed during
715 .\"O The command substitution \fB$(cat \fIfile\fP)\fR can be replaced by
716 .\"O the equivalent but faster \fB$(< \fIfile\fP)\fR.
718 ¤Ë¤è¤ëŸ³«¤Ï¡¢\fIcommand\fP ¤Î¼Â¹Ô¤ª¤è¤Ó¥³¥Þ¥ó¥ÉÃÖ´¹¤ÎÉôʬ¤ò¥³¥Þ¥ó¥É¤Î
719 ɸ½à½ÐÎϤÈÃÖ´¹¤¹¤ë¤³¤È¤Ë¤è¤ê¼Â¹Ô¤µ¤ì¤Þ¤¹¡£¤³¤ÎºÝ¡¢ËöÈø¤Î²þ¹Ôʸ»ú¤Ïºï½ü
720 ¤µ¤ì¤Þ¤¹¡£Ê¸»úÎó¤ÎÅÓÃæ¤Ë¤¢¤ë²þ¹Ôʸ»ú¤Ïºï½ü¤µ¤ì¤Þ¤»¤ó¤¬¡¢Ã±¸ìʬ³ä¤ÎºÝ¤Ë
721 ºï½ü¤µ¤ì¤ë¤³¤È¤¬¤¢¤ê¤Þ¤¹¡£¥³¥Þ¥ó¥ÉÃÖ´¹ \fB$(cat \fIfile\fP)\fR ¤Ï¡¢Æ±
722 ¤¸°ÕÌ£¤ò»ý¤Á¡¢¤·¤«¤â¹â®¤Ê \fB$(< \fIfile\fP)\fR ¤ËÃÖ¤´¹¤¨¤ë¤³¤È¤¬¤Ç
725 .\"O When the old-style backquote form of substitution is used,
726 .\"O backslash retains its literal meaning except when followed by
731 .\"O The first backquote not preceded by a backslash terminates the
732 .\"O command substitution.
733 .\"O When using the $(\^\fIcommand\fP\|) form, all characters between the
734 .\"O parentheses make up the command; none are treated specially.
735 ¥Ð¥Ã¥¯¥¯¥©¡¼¥È¤ò»È¤¦¸Å¤¤·Á¼°¤ÎÃÖ´¹¤òÍѤ¤¤¿¤È¤¡¢¥Ð¥Ã¥¯¥¹¥é¥Ã¥·¥å¤Ïʸ»ú
736 Ä̤ê¤Î°ÕÌ£¤òÊݤÁ¤Þ¤¹¤¬¡¢
740 ¤ÎÁ°¤Ë¤¢¤ë¾ì¹ç¤ÏÎã³°¤È¤Ê¤ê¤Þ¤¹¡£¥Ð¥Ã¥¯¥¹¥é¥Ã¥·¥å¤¬Á°¤ËÃÖ¤«¤ì¤Æ¤¤¤Ê¤¤ºÇ
741 ½é¤Î¥Ð¥Ã¥¯¥¯¥©¡¼¥È¤¬¤¢¤ë¤È¥³¥Þ¥ó¥ÉÃÖ´¹¤ÏÊĤ¸¤é¤ì¤Þ¤¹¡£
742 $(\^\fIcommand\fP\|) ¤È¤¤¤¦·Á¼°¤òÍѤ¤¤¿¤È¤¤Ï¡¢³ç¸Ì¤Î´Ö¤Ë¤¢¤ëÁ´¤Æ¤Îʸ
743 »ú¤¬¥³¥Þ¥ó¥É¤È¤Ê¤ê¤Þ¤¹¡£ÆÃÊÌ°·¤¤¤µ¤ì¤ëʸ»ú¤Ï¤¢¤ê¤Þ¤»¤ó¡£
745 .\"O Command substitutions may be nested. To nest when using the backquoted form,
746 .\"O escape the inner backquotes with backslashes.
747 ¥³¥Þ¥ó¥ÉÃÖ´¹¤ÏÆþ¤ì»Ò¤Ë¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£¥Ð¥Ã¥¯¥¯¥©¡¼¥È·Á¼°¤Î»þ¤ËÆþ¤ì
748 »Ò¤ò¹Ô¤¦¤Ë¤Ï¡¢Æ⦤ΥХ寥¯¥©¡¼¥È¤ò¥Ð¥Ã¥¯¥¹¥é¥Ã¥·¥å¤Ç¥¨¥¹¥±¡¼¥×¤·¤Þ¤¹¡£
750 .\"O If the substitution appears within double quotes, word splitting and
751 .\"O pathname expansion are not performed on the results.
752 ÃÖ´¹¤¬¥À¥Ö¥ë¥¯¥©¡¼¥ÈÆâÉô¤Ë¤¢¤ë¾ì¹ç¤Ë¤Ï¡¢ÃÖ´¹¤Î·ë²Ì¤ËÂФ¹¤ëñ¸ìʬ³ä¤È
753 ¥Ñ¥¹Ì¾Å¸³«¤Ï¹Ô¤ï¤ì¤Þ¤»¤ó¡£
754 .\"O .SS Arithmetic Expansion
757 .\"O Arithmetic expansion allows the evaluation of an arithmetic expression
758 .\"O and the substitution of the result. The format for arithmetic expansion is:
759 »»½Ñ¼°Å¸³«¤ò»È¤¦¤È¡¢»»½Ñ¼°¤òɾ²Á¤·¤Æ¡¢¤½¤Î·ë²Ì¤ËÃÖ´¹¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
760 »»½Ñ¼°Å¸³«¤Î¥Õ¥©¡¼¥Þ¥Ã¥È¤ò¼¡¤Ë¼¨¤·¤Þ¤¹:
763 \fB$((\fP\fIexpression\fP\fB))\fP
768 .\"O is treated as if it were within double quotes, but a double quote
769 .\"O inside the parentheses is not treated specially.
770 .\"O All tokens in the expression undergo parameter expansion, string
771 .\"O expansion, command substitution, and quote removal.
772 .\"O Arithmetic substitutions may be nested.
774 ¤Ï¥À¥Ö¥ë¥¯¥©¡¼¥ÈÆâÉô¤Ë¤¢¤ë¾ì¹ç¤ÈƱÍͤ˰·¤ï¤ì¤Þ¤¹¤¬¡¢³ç¸Ì¤ÎÆ⦤ΥÀ¥Ö¥ë
775 ¥¯¥©¡¼¥È¤¬ÆÃÊÌ°·¤¤¤µ¤ì¤ë¤³¤È¤Ï¤¢¤ê¤Þ¤»¤ó¡£¼°¤Ë´Þ¤Þ¤ì¤ëÁ´¤Æ¤Î¥È¡¼¥¯¥ó¤Ë
776 ÂФ·¤Æ¡¢¥Ñ¥é¥á¡¼¥¿Å¸³«¡¢Ê¸»úÎ󟳫¡¢¥³¥Þ¥ó¥ÉÃÖ´¹¡¢¥¯¥©¡¼¥È¤Îºï½ü¤¬¹Ô¤ï
777 ¤ì¤Þ¤¹¡£»»½Ñ¼°ÃÖ´¹¤ÏÆþ¤ì»Ò¤Ë¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
779 .\"O The evaluation is performed according to the rules listed below under
781 .\"O .BR "ARITHMETIC EVALUATION" .
786 .\"O prints a message indicating failure and no substitution occurs.
790 ¤Ç¼¨¤¹µ¬Â§¤Ë´ð¤Å¤¤¤Æ¹Ô¤ï¤ì¤Þ¤¹¡£
794 ¤Ïɾ²Á¤Î¼ºÇÔ¤ò¼¨¤¹¥á¥Ã¥»¡¼¥¸¤ò½ÐÎϤ·¡¢ÃÖ´¹¤òÁ´¤¯¹Ô¤¤¤Þ¤»¤ó¡£
795 .\"O .SS Process Substitution
798 .\"O \fIProcess substitution\fP is supported on systems that support named
799 .\"O pipes (\fIFIFOs\fP) or the \fB/dev/fd\fP method of naming open files.
800 .\"O It takes the form of
801 .\"O \fB<(\fP\fIlist\^\fP\fB)\fP
803 .\"O \fB>(\fP\fIlist\^\fP\fB)\fP.
804 \fI¥×¥í¥»¥¹ÃÖ´¹ (process substitution)\fP ¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤ë¤Î¤Ï¡¢Ì¾Á°ÉÕ¤
805 ¥Ñ¥¤¥× (\fIFIFO\fP) ¤Þ¤¿¤Ï̾Á°ÉÕ¤¥ª¡¼¥×¥ó¥Õ¥¡¥¤¥ë¤Î \fB/dev/fd\fP ¥á¥½¥Ã
806 ¥É¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¥·¥¹¥Æ¥à¤Ç¤¹¡£¤³¤ì¤Ï
807 \fB<(\fP\fIlist\^\fP\fB)\fP
809 \fB>(\fP\fIlist\^\fP\fB)\fP
811 .\"O [³Îǧ] naming open file ¤ÎÌõ¸ì
812 .\"O The process \fIlist\fP is run with its input or output connected to a
813 .\"O \fIFIFO\fP or some file in \fB/dev/fd\fP. The name of this file is
814 .\"O passed as an argument to the current command as the result of the
815 .\"O expansion. If the \fB>(\fP\fIlist\^\fP\fB)\fP form is used, writing to
816 .\"O the file will provide input for \fIlist\fP. If the
817 .\"O \fB<(\fP\fIlist\^\fP\fB)\fP form is used, the file passed as an
818 .\"O argument should be read to obtain the output of \fIlist\fP.
819 ¥×¥í¥»¥¹¤Î¥ê¥¹¥È \fIlist\fP ¤Î¼Â¹Ô»þ¤Ë¤Ï¡¢¤½¤ÎÆþÎϤޤ¿¤Ï½ÐÎϤϡ¢
820 \fIFIFO\fP ¤Þ¤¿¤Ï \fB/dev/fd\fP Ãæ¤Î²¿¤é¤«¤Î¥Õ¥¡¥¤¥ë¤ËÀܳ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
821 ¤³¤Î¥Õ¥¡¥¤¥ë¤Î̾Á°¤ÏŸ³«¤Î·ë²Ì¤È¤·¤Æ¡¢°ú¤¿ô¤È¤·¤Æ¸½ºß¤Î¥³¥Þ¥ó¥É¤ËÅϤµ
822 ¤ì¤Þ¤¹¡£\fB>(\fP\fIlist\^\fP\fB)\fP ¤Î·Á¼°¤ò»È¤Ã¤¿¾ì¹ç¡¢¥Õ¥¡¥¤¥ë¤Ø¤Î½ñ
823 ¤¹þ¤ß¤Ï \fIlist\fP ¤Ø¤ÎÆþÎϤȤʤê¤Þ¤¹¡£\fB<(\fP\fIlist\^\fP\fB)\fP ¤Î
824 ·Á¼°¤ò»È¤Ã¤¿¾ì¹ç¡¢°ú¤¿ô¤È¤·¤ÆÅϤµ¤ì¤¿¥Õ¥¡¥¤¥ë¤Ï \fIlist\fP ¤Î½ÐÎϤòÆÀ
825 ¤ë¤¿¤á¤ËÆɤ߹þ¤Þ¤ì¤Þ¤¹¡£
827 .\"O When available, process substitution is performed
828 .\"O simultaneously with parameter and variable expansion,
829 .\"O command substitution,
830 .\"O and arithmetic expansion.
831 ÍøÍѲÄǽ¤Ç¤¢¤ì¤Ð¡¢¥×¥í¥»¥¹ÃÖ´¹ (process substitution) ¤Ï¡¢
832 ¥Ñ¥é¥á¡¼¥¿Å¸³«¤äÊÑ¿ôŸ³«¡¢¥³¥Þ¥ó¥ÉÃÖ´¹¡¢»»½Ñ¼°Å¸³«¤ÈƱ»þ¤Ë¹Ô¤ï¤ì¤Þ¤¹¡£
833 .\"O .SS Word Splitting
836 .\"O The shell scans the results of
837 .\"O parameter expansion,
838 .\"O command substitution,
840 .\"O arithmetic expansion
841 .\"O that did not occur within double quotes for
842 .\"O .IR "word splitting" .
843 ¥·¥§¥ë¤Ï¥Ñ¥é¥á¡¼¥¿Å¸³«¤È¥³¥Þ¥ó¥ÉÃÖ´¹¡¢»»½Ñ¼°Å¸³«¤Î·ë²Ì¤ò¥¹¥¥ã¥ó¤·¤Þ¤¹¡£
844 ¥À¥Ö¥ë¥¯¥©¡¼¥È¤ÎÆâÉô¤Ç¤Ï¡¢¤³¤ì¤é¤ÎŸ³«¤Ï
846 ¤ËÂФ·¤Æ¹Ô¤ï¤ì¤Þ¤»¤ó¡£
847 .\"O The shell treats each character of
850 .\"O as a delimiter, and splits the results of the other
851 .\"O expansions into words on these characters. If
854 .\"O is unset, or its
855 .\"O value is exactly
856 .\"O .BR <space><tab><newline> ,
857 .\"O the default, then
861 .\"O characters serves to delimit words. If
864 .\"O has a value other than the default, then sequences of
865 .\"O the whitespace characters
869 .\"O are ignored at the beginning and end of the
870 .\"O word, as long as the whitespace character is in the
877 .\"O whitespace character).
881 ¤Î¤½¤ì¤¾¤ì¤Îʸ»ú¤ò¶èÀÚ¤êʸ»ú¤È¤·¤Æ°·¤¤¡¢Â¾¤ÎŸ³«¤Î·ë²Ì¤ò¤³¤ì¤é¤Îʸ»ú¤Ë¤è¤Ã¤Æ
885 ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¤«¡¢¤½¤ÎÃͤ¬Àµ³Î¤Ë¥Ç¥Õ¥©¥ë¥ÈÃͤÎ
886 .BR <¥¹¥Ú¡¼¥¹><¥¿¥Ö><²þ¹Ô>
890 ʸ»ú¤ÎǤ°Õ¤ÎÎó¤Çñ¸ì¤¬¶èÀÚ¤é¤ì¤Þ¤¹¡£
893 ¤¬¥Ç¥Õ¥©¥ë¥È°Ê³°¤ÎÃͤò»ý¤Ã¤Æ¤¤¤ì¤Ð¡¢¶õÇòʸ»ú (
897 ) ¤ÎÎó¤Ïñ¸ì¤ÎÀèƬ¤ÈËöÈø¤Ç¤Ï̵»ë¤µ¤ì¤Þ¤¹¡£¤³¤ì¤Ï¶õÇòʸ»ú¤¬
903 ¶õÇòʸ»ú) ¤Ë´Þ¤Þ¤ì¤ë¸Â¤êÀ®¤êΩ¤Á¤Þ¤¹¡£
904 .\"O Any character in
910 .\"O whitespace, along with any adjacent
913 .\"O whitespace characters, delimits a field.
919 ¶õÇòʸ»ú¤Ç¤Ï¤Ê¤¤Ê¸»ú¤ÏÁ´¤Æ¡¢ÎÙÀܤ¹¤ëǤ°Õ¤Î
922 ¶õÇòʸ»ú¤È°ì½ï¤Ë¤Ê¤Ã¤Æ¥Õ¥£¡¼¥ë¥É¤Î¶èÀÚ¤ê¤È¤Ê¤ê¤Þ¤¹¡£
926 .\"O whitespace characters is also treated as a delimiter.
930 .\"O is null, no word splitting occurs.
933 ¶õÇòʸ»ú¤ÎÎó¤â¶èÀÚ¤êʸ»ú¤È¤·¤Æ°·¤ï¤ì¤Þ¤¹¡£
936 ¤ÎÃͤ¬¶õʸ»úÎó¤Ç¤¢¤ì¤Ð¡¢Ã±¸ìʬ³ä¤ÏÁ´¤¯¹Ô¤ï¤ì¤Þ¤»¤ó¡£
938 .\"O Explicit null arguments (\^\f3"\^"\fP or \^\f3'\^'\fP\^) are retained.
939 .\"O Unquoted implicit null arguments, resulting from the expansion of
940 .\"O parameters that have no values, are removed.
941 .\"O If a parameter with no value is expanded within double quotes, a
942 .\"O null argument results and is retained.
943 ÌÀ¼¨Åª¤Ë»ØÄꤷ¤¿¶õ¤Î°ú¤¿ô(\^\f3"\^"\fP ¤Þ¤¿¤Ï \^\f3'\^'\fP\^)¤Ïºï½ü¤µ
944 ¤ì¤º¤Ë»Ä¤ê¤Þ¤¹¡£¥¯¥©¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¡¢°ÅÌÛŪ¤Ë»ØÄꤵ¤ì¤¿¶õ¤Î°ú¤¿ô¤Ï¡¢
945 Ãͤò»ý¤¿¤Ê¤¤¥Ñ¥é¥á¡¼¥¿¤òŸ³«¤·¤¿·ë²Ì¤È¤·¤ÆÆÀ¤é¤ì¤Þ¤¹¤¬¡¢¤³¤ì¤é¤Ïºï½ü¤µ¤ì¤Þ¤¹¡£
946 Ãͤò»ý¤¿¤Ê¤¤¥Ñ¥é¥á¡¼¥¿¤¬¥À¥Ö¥ë¥¯¥©¡¼¥ÈÆâÉô¤ÇŸ³«¤µ¤ì¤ë¤È¡¢
947 ¤³¤ì¤Ï¶õ¤Ç¤¢¤ë°ú¤¿ô¤È¤Ê¤ê¡¢¾Ã¤µ¤ì¤º¤Ë»Ä¤ê¤Þ¤¹¡£
949 .\"O Note that if no expansion occurs, no splitting
951 Ÿ³«¤¬¹Ô¤ï¤ì¤Ê¤±¤ì¤Ðñ¸ìʬ³ä¤â¹Ô¤ï¤ì¤Ê¤¤ÅÀ¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£
952 .\"O .SS Pathname Expansion
955 .\"O After word splitting,
958 .\"O option has been set,
960 .\"O scans each word for the characters
966 ¥ª¥×¥·¥ç¥ó¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¡¢Ã±¸ìʬ³ä¤ò¹Ô¤Ã¤¿¸å¤Ë
972 ¤ò´Þ¤ó¤Ç¤¤¤ë¤«¤É¤¦¤«Ä´¤Ù¤Þ¤¹¡£
973 .\"O If one of these characters appears, then the word is
976 .\"O and replaced with an alphabetically sorted list of
977 .\"O file names matching the pattern.
978 ¤³¤ì¤é¤Îʸ»ú¤Î¤¤¤º¤ì¤«¤¬¸«¤Ä¤«¤ë¤È¡¢¤½¤Îñ¸ì¤Ï
980 ¤È¸«¤Ê¤µ¤ì¡¢¥Ñ¥¿¡¼¥ó¤Ë¥Þ¥Ã¥Á¤¹¤ë¥Õ¥¡¥¤¥ë̾¤ò¥¢¥ë¥Õ¥¡¥Ù¥Ã¥È½ç¤Ë¥½¡¼¥È¤·
981 ¤¿¥ê¥¹¥È¤ËÃÖ´¹¤µ¤ì¤Þ¤¹¡£
982 .\"O If no matching file names are found,
983 .\"O and the shell option
985 .\"O is disabled, the word is left unchanged.
986 ¥Þ¥Ã¥Á¤¹¤ë¥Õ¥¡¥¤¥ë̾¤¬¸«¤Ä¤«¤é¤º¡¢¤«¤Ä¥·¥§¥ë¤Î¥ª¥×¥·¥ç¥ó
988 ¤¬Ìµ¸ú¤Ê¤é¤Ð¡¢¤½¤Îñ¸ì¤ÏÊѹ¹¤µ¤ì¤º¤Ë¤½¤Î¤Þ¤Þ»Ä¤ê¤Þ¤¹¡£
991 .\"O option is set, and no matches are found,
992 .\"O the word is removed.
994 ¥ª¥×¥·¥ç¥ó¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Æ¡¢¤«¤Ä¥Þ¥Ã¥Á¤¹¤ë¥Õ¥¡¥¤¥ë̾¤¬¸«¤Ä¤«¤é¤Ê¤±¤ì¤Ð¡¢¤½¤Î
996 .\"O If the shell option
998 .\"O is enabled, the match is performed without regard to the case
999 .\"O of alphabetic characters.
1002 ¤¬Í¸ú¤Ê¤é¤Ð¡¢¥Þ¥Ã¥Á¥ó¥°¤Ë¤ª¤¤¤Æ¥¢¥ë¥Õ¥¡¥Ù¥Ã¥È¤ÎÂçʸ»ú¤È¾®Ê¸»ú¤Ï¶èÊ̤µ
1004 .\"O When a pattern is used for pathname expansion,
1007 .\"O at the start of a name or immediately following a slash
1008 .\"O must be matched explicitly, unless the shell option
1011 ¥Ñ¥¿¡¼¥ó¤ò¥Ñ¥¹Ì¾Å¸³«¤Ë»È¤¦¤È¤¡¢Ì¾Á°¤ÎÀèƬ¤ä¥¹¥é¥Ã¥·¥å¤Îľ¸å¤Î
1013 ¤ÏÌÀ¼¨Åª¤Ë¥Þ¥Ã¥Á¤µ¤»¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£¤¿¤À¤·¡¢¥·¥§¥ë¤Î¥ª¥×¥·¥ç¥ó
1015 ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï½ü¤¤Þ¤¹¡£
1016 .\"O When matching a pathname, the slash character must always be
1017 .\"O matched explicitly.
1018 .\"O In other cases, the
1020 .\"O character is not treated specially.
1021 ¥Ñ¥¹Ì¾¤Î¥Þ¥Ã¥Á¥ó¥°¤ò¹Ô¤¦¤È¤¡¢¥¹¥é¥Ã¥·¥åʸ»ú¤Ïɬ¤ºÌÀ¼¨Åª¤Ë¥Þ¥Ã¥Á¤µ¤»¤Ê
1022 ¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£¤³¤ì°Ê³°¤Î¾ì¹ç¤Ë¤Ï¡¢
1024 ¤¬ÆÃÊÌ°·¤¤¤µ¤ì¤ë¤³¤È¤Ï¤¢¤ê¤Þ¤»¤ó¡£
1025 .\"O See the description of
1029 .\"O .B SHELL BUILTIN COMMANDS
1030 .\"O for a description of the
1031 .\"O .BR nocaseglob ,
1040 ¤Î¾Ü¤·¤¤ÀâÌÀ¤Ë¤Ä¤¤¤Æ¤Ï¡¢¸å½Ò¤Î
1042 .B ¥·¥§¥ë¤ÎÁȤ߹þ¤ß¥³¥Þ¥ó¥É
1045 ¤ÎÀâÌÀ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
1050 .\"O shell variable may be used to restrict the set of file names matching a
1057 ¤Ë¥Þ¥Ã¥Á¤¹¤ë¥Õ¥¡¥¤¥ë̾¤Î½¸¹ç¤òÀ©¸Â¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
1061 .\"O is set, each matching file name that also matches one of the patterns in
1064 .\"O is removed from the list of matches.
1067 ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ì¤Ð¡¢¥Þ¥Ã¥Á¤¹¤ë¥Õ¥¡¥¤¥ë̾¤Î¤¦¤Á
1070 Ãæ¤Î¥Ñ¥¿¡¼¥ó¤Ë¤â¥Þ¥Ã¥Á¤·¤¿¤â¤Î¤Ï¡¢¥Þ¥Ã¥Á¤·¤¿¤â¤Î¤Î¥ê¥¹¥È¤«¤é¼è¤ê½ü¤«¤ì
1076 .\"O are always ignored, even when
1079 .\"O is set. However, setting
1082 .\"O has the effect of enabling the
1084 .\"O shell option, so all other file names beginning with a
1091 ¤Ïɬ¤ºÌµ»ë¤µ¤ì¤Þ¤¹¡£¤³¤ì¤Ï
1094 ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Æ¤âƱ¤¸¤Ç¤¹¡£¤·¤«¤·¡¢
1097 ¤òÀßÄꤹ¤ë¤È¥·¥§¥ë¥ª¥×¥·¥ç¥ó¤Î
1101 ¤Ç»Ï¤Þ¤ë¾¤Î¥Õ¥¡¥¤¥ë̾¤ÏÁ´¤Æ¥Þ¥Ã¥Á¤·¤Þ¤¹¡£
1102 .\"O To get the old behavior of ignoring file names beginning with a
1106 .\"O one of the patterns in
1108 .\"O .BR GLOBIGNORE .
1110 ¤Ç»Ï¤á¤ë¥Õ¥¡¥¤¥ë̾¤ò̵»ë¤¹¤ë¸Å¤¤Æ°ºî¤ò¤µ¤»¤ë¤Ë¤Ï¡¢
1115 ¤Î¥Ñ¥¿¡¼¥ó¤Ë´Þ¤á¤Æ¤¯¤À¤µ¤¤¡£
1118 .\"O option is disabled when
1124 ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¡¢
1126 ¥ª¥×¥·¥ç¥ó¤Ï̵¸ú¤Ë¤Ê¤ê¤Þ¤¹¡£
1128 .\"O \fBPattern Matching\fP
1129 \fB¥Ñ¥¿¡¼¥ó¥Þ¥Ã¥Á¥ó¥°\fP
1131 .\"O Any character that appears in a pattern, other than the special pattern
1132 .\"O characters described below, matches itself. The NUL character may not
1133 .\"O occur in a pattern. The special pattern characters must be quoted if
1134 .\"O they are to be matched literally.
1135 ¥Ñ¥¿¡¼¥ó¤Ë´Þ¤Þ¤ì¤ëʸ»ú¤Î¤¦¤Á¡¢¸å½Ò¤¹¤ëÆüì¥Ñ¥¿¡¼¥óʸ»ú°Ê³°¤Îʸ»ú¤Ï¡¢¼«
1136 ʬ¼«¿È¤Ë¥Þ¥Ã¥Á¤·¤Þ¤¹¡£NUL ʸ»ú¤¬¥Ñ¥¿¡¼¥óÃæ¤Ë¸½¤ï¤ì¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£Æüì
1137 ¥Ñ¥¿¡¼¥óʸ»ú¤ò¤½¤Îʸ»ú¤½¤Î¤â¤Î¤Ë¥Þ¥Ã¥Á¤µ¤»¤ë¤¿¤á¤Ë¤Ï¡¢¥¯¥©¡¼¥È¤·¤Ê¤±¤ì
1140 .\"O The special pattern characters have the following meanings:
1141 Æüì¥Ñ¥¿¡¼¥óʸ»ú¤Ï°Ê²¼¤Î°ÕÌ£¤ò»ý¤Ã¤Æ¤¤¤Þ¤¹:
1146 .\"O Matches any string, including the null string.
1147 ¶õʸ»úÎó¤ò´Þ¤à¡¢Ç¤°Õ¤Îʸ»úÎó¤Ë¥Þ¥Ã¥Á¤·¤Þ¤¹¡£
1150 .\"O Matches any single character.
1151 Ǥ°Õ¤Î 1 ʸ»ú¤Ë¥Þ¥Ã¥Á¤·¤Þ¤¹¡£
1154 .\"O Matches any one of the enclosed characters. A pair of characters
1155 .\"O separated by a minus sign denotes a
1157 .\"O any character lexically between those two characters, inclusive,
1158 .\"O is matched. If the first character following the
1164 .\"O then any character not enclosed is matched.
1165 ³ç¤é¤ì¤¿Ê¸»ú¤Î¤¦¤ÁǤ°Õ¤Î 1 ʸ»ú¤Ë¥Þ¥Ã¥Á¤·¤Þ¤¹¡£2 ¤Ä¤Îʸ»ú¤Î´Ö¤Ë¥Þ¥¤¥Ê
1166 ¥¹µ¹æ¤òÆþ¤ì¤¿¤â¤Î¤Ï¡¢
1168 ¤òɽ¤·¤Þ¤¹¡£¤Ä¤Þ¤ê¡¢¼½ñŪ¤Ë 2 ¤Ä¤Îʸ»ú¤Î´Ö¤Ë¤Ê¤ëǤ°Õ¤Îʸ»ú¤È¡¢Î¾Ã¼¤Î
1169 2 ʸ»ú¤¬¥Þ¥Ã¥Á¤·¤Þ¤¹¡£
1175 ¤Ê¤é¤Ð¡¢³ç¤é¤ì¤¿Ê¸»ú¤Ë´Þ¤Þ¤ì¤Ê¤¤Ç¤°Õ¤Îʸ»ú¤¬¥Þ¥Ã¥Á¤·¤Þ¤¹¡£
1178 .\"O may be matched by including it as the first or last character
1181 ¤Ï¡¢Ê¸»ú½¸¹ç¤ÎºÇ½é¤Þ¤¿¤ÏºÇ¸å¤Îʸ»ú¤È¤·¤Æ´Þ¤á¤ë¤È¥Þ¥Ã¥Á¥ó¥°¤ÎÂоݤˤ¹¤ë
1185 .\"O may be matched by including it as the first character
1188 ¤Ï¡¢Ê¸»ú½¸¹ç¤ÎºÇ½é¤Îʸ»ú¤È¤·¤Æ´Þ¤á¤ë¤È¥Þ¥Ã¥Á¥ó¥°¤ÎÂоݤˤ¹¤ë¤³¤È¤¬¤Ç¤
1197 .\"O \fIcharacter classes\fP can be specified using the syntax
1198 .\"O \fB[:\fP\fIclass\fP\fB:]\fP, where \fIclass\fP is one of the
1199 .\"O following classes defined in the POSIX.2 standard:
1203 ¤Î´Ö¤Ç¤Ï¡¢\fIʸ»ú¥¯¥é¥¹ (character classes)\fP ¤ò»ØÄꤹ¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
1204 »ØÄê¤Ë¤Ï \fB[:\fP\fIclass\fP\fB:]\fP ¤È¤¤¤¦µË¡¤ò»È¤¤¤Þ¤¹¡£¤³¤³¤Ç¡¢
1205 \fIclass\fP ¤Ï POSIX.2 ɸ½à¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë°Ê²¼¤Î¥¯¥é¥¹¤Î¤¤¤º¤ì¤«¤Ç¤¹:
1209 .if n alnum alpha ascii blank cntrl digit graph lower print punct space upper xdigit
1210 .if t alnum alpha ascii blank cntrl digit graph lower print punct space upper xdigit
1212 .\"O A character class matches any character belonging to that class.
1213 ʸ»ú¥¯¥é¥¹¤Ï¡¢¤½¤Î¥¯¥é¥¹¤Î°¤¹¤ëǤ°Õ¤Îʸ»ú¤Ë¥Þ¥Ã¥Á¤·¤Þ¤¹¡£
1221 .\"O an \fIequivalence class\fP can be specified using the syntax
1222 .\"O \fB[=\fP\fIc\fP\fB=]\fP, which matches all characters with the
1223 .\"O same collation weight (as defined by the current locale) as
1224 .\"O the character \fIc\fP.
1228 ¤Î´Ö¤Ç¤Ï¡¢\fIƱÃÍ¥¯¥é¥¹ (equivalence class)\fP ¤ò»ØÄꤹ¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
1229 »ØÄê¤Ë¤Ï \fB[=\fP\fIc\fP\fB=]\fP ¤È¤¤¤¦µË¡¤ò»È¤¤¤Þ¤¹¡£¤³¤ì¤Ï \fIc\fP
1230 ¤ÈƱ¤¸¾È¹ç¤Î½Å¤ßÉÕ¤± (collation weight, ¸½ºß¤Î¥í¥±¡¼¥ë¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë
1231 Ãͤ¬»ÈÍѤµ¤ì¤Þ¤¹) ¤ò»ý¤ÄÁ´¤Æ¤Îʸ»ú¤Ë¥Þ¥Ã¥Á¤·¤Þ¤¹¡£
1239 .\"O the syntax \fB[.\fP\fIsymbol\fP\fB.]\fP matches the collating symbol
1244 ¤Î´Ö¤Ç¤Ï¡¢\fB[.\fP\fIsymbol\fP\fB.]\fP ¤È¤¤¤¦µ½Ò¤Ï¾È¹ç¥·¥ó¥Ü¥ë
1245 \fIsymbol\fP ¤Ë¥Þ¥Ã¥Á¤·¤Þ¤¹¡£
1246 .\"O WORD: collating symbol ¾È¹ç¥·¥ó¥Ü¥ë
1250 .\"O If the \fBextglob\fP shell option is enabled using the \fBshopt\fP
1251 .\"O builtin, several extended pattern matching operators are recognized.
1252 .\"O In the following description, a \fIpattern-list\fP is a list of one
1253 .\"O or more patterns separated by a \fB|\fP.
1254 .\"O Composite patterns may be formed using one or more of the following
1256 ÁȤ߹þ¤ß¥³¥Þ¥ó¥É¤Î \fBshopt\fP ¤ò»È¤Ã¤Æ¥·¥§¥ë¤Î¥ª¥×¥·¥ç¥ó
1257 \fBextglob\fP ¤¬Í¸ú¤Ë¤µ¤ì¤Æ¤¤¤ë¤È¡¢³ÈÄ¥¥Ñ¥¿¡¼¥ó¥Þ¥Ã¥Á¥ó¥°±é»»»Ò¤¬¤¤¤¯
1258 ¤Ä¤«Ç§¼±¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£°Ê²¼¤ÎÀâÌÀ¤Ç¤Ï¡¢\fIpattern-list\fP ¤Ï
1259 \fB|\fP ¤Ç¶èÀÚ¤é¤ì¤¿ 1 ¤Ä°Ê¾å¤Î¥Ñ¥¿¡¼¥ó¤Î¥ê¥¹¥È¤Ç¤¢¤ë¤â¤Î¤È¤·¤Þ¤¹¡£°Ê
1260 ²¼¤Î¥µ¥Ö¥Ñ¥¿¡¼¥ó¤ò 1 ¤Ä¤¢¤ë¤¤¤ÏÊ£¿ô»È¤¦¤³¤È¤Ë¤è¤ê¡¢Ê£¹ç¥Ñ¥¿¡¼¥ó¤òºî¤ë
1262 .\"O WORD: composite pattern Ê£¹ç¥Ñ¥¿¡¼¥ó
1263 .\"O WORD: sub-pattern ¥µ¥Ö¥Ñ¥¿¡¼¥ó
1268 \fB?(\fP\^\fIpattern-list\^\fP\fB)\fP
1269 .\"O Matches zero or one occurrence of the given patterns
1270 Í¿¤¨¤é¤ì¤¿¥Ñ¥¿¡¼¥ó¤¬ 0 ²ó¤Þ¤¿¤Ï 1 ²ó¸½¤ï¤ì¤ë¤È¥Þ¥Ã¥Á¤·¤Þ¤¹¡£
1272 \fB*(\fP\^\fIpattern-list\^\fP\fB)\fP
1273 .\"O Matches zero or more occurrences of the given patterns
1274 Í¿¤¨¤é¤ì¤¿¥Ñ¥¿¡¼¥ó¤¬ 0 ²ó°Ê¾å¸½¤ï¤ì¤ë¤È¥Þ¥Ã¥Á¤·¤Þ¤¹¡£
1276 \fB+(\fP\^\fIpattern-list\^\fP\fB)\fP
1277 .\"O Matches one or more occurrences of the given patterns
1278 Í¿¤¨¤é¤ì¤¿¥Ñ¥¿¡¼¥ó¤¬ 1 ²ó°Ê¾å¸½¤ï¤ì¤ë¤È¥Þ¥Ã¥Á¤·¤Þ¤¹¡£
1280 \fB@(\fP\^\fIpattern-list\^\fP\fB)\fP
1281 .\"O Matches exactly one of the given patterns
1282 Í¿¤¨¤é¤ì¤¿¥Ñ¥¿¡¼¥ó¤Î¤¦¤Á 1 ¤Ä¤À¤±¤Ë¥Þ¥Ã¥Á¤·¤Þ¤¹¡£
1284 \fB!(\fP\^\fIpattern-list\^\fP\fB)\fP
1285 .\"O Matches anything except one of the given patterns
1286 Í¿¤¨¤é¤ì¤¿¥Ñ¥¿¡¼¥ó¤¤¤º¤ì¤Ë¤â´Þ¤Þ¤ì¤Ê¤¤¤â¤ÎÁ´¤Æ¤Ë¥Þ¥Ã¥Á¤·¤Þ¤¹¡£
1289 .\"O .SS Quote Removal
1292 .\"O After the preceding expansions, all unquoted occurrences of the
1296 .\"O and \^\f3"\fP\^ that did not result from one of the above
1297 .\"O expansions are removed.
1298 Àè¤Ë½èÍý¤µ¤ì¤ëŸ³«¤Î¸å¡¢¥¯¥©¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤
1302 ¤Î¤¦¤Á¡¢Àè¤ÎŸ³«¤Î·ë²Ì¤Ç¤Ê¤¤¤â¤Î¤ÏÁ´¤Æºï½ü¤µ¤ì¤Þ¤¹¡£