OSDN Git Service

GNU_bash: Merge upstream changes for bashbug.1, builtins.1, rbash.1 in bash-4.2.
[linuxjm/jm.git] / manual / GNU_bash / work / P05
1 .\"O .SH REDIRECTION
2 .SH ¥ê¥À¥¤¥ì¥È
3 .\"O Before a command is executed, its input and output
4 .\"O may be
5 .\"O .I redirected
6 .\"O using a special notation interpreted by the shell.
7 .\"O Redirection may also be used to open and close files for the
8 .\"O current shell execution environment.  The following redirection
9 .\"O operators may precede or appear anywhere within a
10 .\"O .I simple command
11 .\"O or may follow a
12 .\"O .IR command .
13 .\"O Redirections are processed in the order they appear, from
14 .\"O left to right.
15 ¥·¥§¥ë¤¬²ò¼á¤¹¤ëÆÃÊ̤ʵ­Ë¡¤òÍѤ¤¤Æ¡¢¥³¥Þ¥ó¥É¤Î¼Â¹ÔÁ°¤ËÆþ½ÐÎϤò
16 .I ¥ê¥À¥¤¥ì¥¯¥È
17 ¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤Þ¤¿¡¢¥ê¥À¥¤¥ì¥¯¥È¤ò»È¤¦¤È¡¢¸½ºß¤Î¥·¥§¥ë¼Â¹Ô´Ä
18 ¶­¤ËÂФ·¤Æ¥Õ¥¡¥¤¥ë¤ò¥ª¡¼¥×¥ó¤Þ¤¿¤Ï¥¯¥í¡¼¥º¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£°Ê²¼¤Ë
19 ¼¨¤¹¥ê¥À¥¤¥ì¥¯¥È±é»»»Ò¤Ï
20 .I Ã±½ã¤Ê¥³¥Þ¥ó¥É
21 ¤ÎÁ°¤äÅÓÃæ¤ËÃÖ¤¯¤³¤È¤¬¤Ç¤­¤Þ¤¹¤·¡¢
22 .I ¥³¥Þ¥ó¥É
23 ¤Î¸å¤ËÃÖ¤¯¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¥ê¥À¥¤¥ì¥¯¥È¤Ïº¸¤«¤é±¦¤Ø¤È
24 ¸½¤ï¤ì¤¿½ç¤Ë½èÍý¤µ¤ì¤Þ¤¹¡£
25 .PP
26 .\"O In the following descriptions, if the file descriptor number is
27 .\"O omitted, and the first character of the redirection operator is
28 .\"O .BR < ,
29 .\"O the redirection refers to the standard input (file descriptor
30 .\"O 0).  If the first character of the redirection operator is
31 .\"O .BR > ,
32 .\"O the redirection refers to the standard output (file descriptor
33 .\"O 1).
34 °Ê²¼¤ÎÀâÌÀ¤Ë¤ª¤¤¤Æ¤Ï¡¢¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼Èֹ椬¾Êά¤µ¤ì¡¢
35 ¤«¤Ä¥ê¥À¥¤¥ì¥¯¥È±é»»»Ò¤ÎºÇ½é¤Îʸ»ú¤¬
36 .BR <
37 ¤Ê¤é¤Ð¡¢¥ê¥À¥¤¥ì¥¯¥È¤Ïɸ½àÆþÎÏ(¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼ 0)¤ò»²¾È¤·¤Þ¤¹¡£
38 ¥ê¥À¥¤¥ì¥¯¥È±é»»»Ò¤ÎºÇ½é¤Îʸ»ú¤¬
39 .BR >
40 ¤Ê¤é¤Ð¡¢¥ê¥À¥¤¥ì¥¯¥È¤Ïɸ½à½ÐÎÏ(¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼ 1)¤ò»²¾È¤·¤Þ¤¹¡£
41 .PP
42 .\"O The word following the redirection operator in the following
43 .\"O descriptions, unless otherwise noted, is subjected to brace expansion,
44 .\"O tilde expansion, parameter expansion, command substitution, arithmetic
45 .\"O expansion, quote removal, pathname expansion, and word splitting.
46 .\"O If it expands to more than one word,
47 .\"O .B bash
48 .\"O reports an error.
49 °Ê²¼¤ÎÀâÌÀ¤Ç¤Ï¡¢¥ê¥À¥¤¥ì¥¯¥È±é»»»Ò¤Î¼¡¤Îñ¸ì¤ËÂФ·¤Æ¤Ï¡¢ÆäËÀâÌÀ¤·
50 ¤Ê¤¤¸Â¤ê¡¢¥Ö¥ì¡¼¥¹Å¸³«¡¢¥Á¥ë¥ÀŸ³«¡¢¥Ñ¥é¥á¡¼¥¿Å¸³«¡¢¥³¥Þ¥ó¥ÉÃÖ´¹¡¢
51 »»½Ñ¼°Å¸³«¡¢¥¯¥©¡¼¥Èºï½ü¡¢¥Ñ¥¹Ì¾Å¸³«¡¢Ã±¸ìʬ³ä¤¬¹Ô¤ï¤ì¤Þ¤¹¡£
52 ¤¢¤ëñ¸ì¤¬Ê£¿ô¤Îñ¸ì¤ËŸ³«¤µ¤ì¤¿¾ì¹ç¤Ï¥¨¥é¡¼¤Ë¤Ê¤ê¤Þ¤¹¡£
53 .PP
54 .\"O Note that the order of redirections is significant.  For example, 
55 .\"O the command
56 ¥ê¥À¥¤¥ì¥¯¥È¤Î½çÈ֤ˤϰÕÌ£¤¬¤¢¤ëÅÀ¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£
57 Î㤨¤Ð¡¢¼¡¤Î¥³¥Þ¥ó¥É
58 .RS
59 .PP
60 ls \fB>\fP dirlist 2\fB>&\fP1
61 .RE
62 .PP
63 .\"O directs both standard output and standard error to the file 
64 .\"O .IR dirlist ,
65 .\"O while the command
66 ¤Ïɸ½à½ÐÎϤÈɸ½à¥¨¥é¡¼½ÐÎϤòξÊý¤È¤â¥Õ¥¡¥¤¥ë
67 .IR dirlist
68 ¤Ë½ñ¤­¹þ¤ß¤Þ¤¹¤¬¡¢¼¡¤Î¥³¥Þ¥ó¥É
69 .RS
70 .PP
71 ls 2\fB>&\fP1 \fB>\fP dirlist
72 .RE
73 .PP
74 .\"O directs only the standard output to file
75 .\"O .IR dirlist ,
76 .\"O because the standard error was duplicated as standard output
77 .\"O before the standard output was redirected to
78 .\"O .IR dirlist .
79 ¤Ç¤Ïɸ½à½ÐÎϤÀ¤±¤¬¥Õ¥¡¥¤¥ë
80 .IR dirlist
81 ¤Ë½ñ¤­¹þ¤Þ¤ì¤Þ¤¹¡£¤Ê¤¼¤Ê¤é¸å¼Ô¤Î¾ì¹ç¤Ë¤Ï¡¢É¸½à¥¨¥é¡¼½ÐÎϤÏ
82 .IR dirlist
83 ¤Ë¥ê¥À¥¤¥ì¥¯¥È¤µ¤ì¤ëÁ°¤Îɸ½à½ÐÎϤÎÊ£À½¤È¤Ê¤ë¤«¤é¤Ç¤¹¡£
84 ¤Ç¤¹¡£
85 .PP
86 .\"O \fBBash\fP handles several filenames specially when they are used in
87 .\"O redirections, as described in the following table:
88 \fBbash\fP ¤Ï¥ê¥À¥¤¥ì¥¯¥È¤Ë»ÈÍѤ·¤¿¾ì¹ç¤Ë¡¢°Ê²¼¤Îɽ¤Ë¤¢¤ë¤è¤¦¤Ê
89 ¤¤¤¯¤Ä¤«¤ÎÆÃÊ̤ʥե¡¥¤¥ë̾»ØÄê¤ò°·¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
90 .RS
91 .PP
92 .PD 0
93 .TP
94 .B /dev/fd/\fIfd\fP
95 .\"O If \fIfd\fP is a valid integer, file descriptor \fIfd\fP is duplicated.
96 \fIfd\fP ¤¬Í­¸ú¤ÊÀ°¿ô¤Ê¤é¤Ð¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼ \fIfd\fP ¤¬Ê£À½¤µ¤ì¤Þ¤¹¡£
97 .TP
98 .B /dev/stdin
99 .\"O File descriptor 0 is duplicated.
100 ¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼ 0 ¤¬Ê£À½¤µ¤ì¤Þ¤¹¡£
101 .TP
102 .B /dev/stdout
103 .\"O File descriptor 1 is duplicated.
104 ¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼ 1 ¤¬Ê£À½¤µ¤ì¤Þ¤¹¡£
105 .TP
106 .B /dev/stderr
107 .\"O File descriptor 2 is duplicated.
108 ¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼ 2 ¤¬Ê£À½¤µ¤ì¤Þ¤¹¡£
109 .TP
110 .B /dev/tcp/\fIhost\fP/\fIport\fP
111 .\"O If \fIhost\fP is a valid hostname or Internet address, and \fIport\fP
112 .\"O is an integer port number, \fBbash\fP attempts to open a TCP connection
113 .\"O to the corresponding socket.
114 \fIhost\fP ¤¬Í­¸ú¤Ê¥Û¥¹¥È̾¤Þ¤¿¤Ï¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥¢¥É¥ì¥¹¤Ç
115 \fIport\fP ¤¬À°¿ô¤Î¥Ý¡¼¥ÈÈÖ¹æ¤Ê¤é¤Ð¡¢\fBbash\fP ¤ÏÂбþ¤¹¤ë¥½¥±¥Ã¥È¤Ë
116 ÂФ·¤Æ TCP Àܳ¤Î¥ª¡¼¥×¥ó¤ò»î¤ß¤Þ¤¹¡£
117 .TP
118 .B /dev/udp/\fIhost\fP/\fIport\fP
119 .\"O If \fIhost\fP is a valid hostname or Internet address, and \fIport\fP
120 .\"O is an integer port number, \fBbash\fP attempts to open a UDP connection
121 .\"O to the corresponding socket.
122 \fIhost\fP ¤¬Í­¸ú¤Ê¥Û¥¹¥È̾¤Þ¤¿¤Ï¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥¢¥É¥ì¥¹¤Ç
123 \fIport\fP ¤¬À°¿ô¤Î¥Ý¡¼¥ÈÈÖ¹æ¤Ê¤é¤Ð¡¢\fBbash\fP ¤ÏÂбþ¤¹¤ë¥½¥±¥Ã¥È¤Ë
124 ÂФ·¤Æ UDP Àܳ¤Î¥ª¡¼¥×¥ó¤ò»î¤ß¤Þ¤¹¡£
125 \" ÌõÃí UDP connection ¤È¤¤¤¦¤Î¤Ï¥Ê¥ó¥»¥ó¥¹?!?
126 .PD
127 .RE
128 .PP
129 .\"O A failure to open or create a file causes the redirection to fail.
130 ¥Õ¥¡¥¤¥ë¤Î¥ª¡¼¥×¥ó¤äºîÀ®¤Ë¼ºÇÔ¤¹¤ë¤È¡¢¥ê¥À¥¤¥ì¥¯¥È¤â¼ºÇÔ¤·¤Þ¤¹¡£
131 .\"O .SS Redirecting Input
132 .SS ÆþÎϤΥê¥À¥¤¥ì¥¯¥È
133 .PP
134 .\"O Redirection of input causes the file whose name results from
135 .\"O the expansion of
136 .\"O .I word
137 .\"O to be opened for reading on file descriptor
138 .\"O .IR n ,
139 .\"O or the standard input (file descriptor 0) if
140 .\"O .I n
141 .\"O is not specified.
142 ÆþÎϤò¥ê¥À¥¤¥ì¥¯¥È¤¹¤ë¤È¡¢
143 .I word
144 ¤ÎŸ³«¤ÇÆÀ¤¿Ì¾Á°¤ò»ý¤Ä¥Õ¥¡¥¤¥ë¤¬¥ª¡¼¥×¥ó¤µ¤ì¡¢¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼
145 .IR n
146 ¤ÇÆɤ߹þ¤á¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£
147 .I n
148 ¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¡¢Æɤ߹þ¤ß¤Ïɸ½àÆþÎÏ(¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼ 0)¤Ç
149 ¹Ô¤ï¤ì¤Þ¤¹¡£
150 .PP
151 .\"O The general format for redirecting input is:
152 ÆþÎϤΥê¥À¥¤¥ì¥¯¥È¤Ï¡¢°ìÈÌŪ¤Ë¤Ï°Ê²¼¤Î·Á¼°¤Ç¤¹:
153 .RS
154 .PP
155 [\fIn\fP]\fB<\fP\fIword\fP
156 .RE
157 .\"O .SS Redirecting Output
158 .SS ½ÐÎϤΥê¥À¥¤¥ì¥¯¥È
159 .PP
160 .\"O Redirection of output causes the file whose name results from
161 .\"O the expansion of
162 .\"O .I word
163 .\"O to be opened for writing on file descriptor
164 .\"O .IR n ,
165 .\"O or the standard output (file descriptor 1) if
166 .\"O .I n
167 .\"O is not specified.  If the file does not exist it is created;
168 .\"O if it does exist it is truncated to zero size.
169 ½ÐÎϤò¥ê¥À¥¤¥ì¥¯¥È¤¹¤ë¤È¡¢
170 .I word
171 ¤ÎŸ³«¤ÇÆÀ¤¿Ì¾Á°¤ò»ý¤Ä¥Õ¥¡¥¤¥ë¤¬¥ª¡¼¥×¥ó¤µ¤ì¡¢¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼
172 .IR n
173 ¤Ç½ñ¤­¹þ¤á¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£
174 .I n
175 ¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¡¢Æɤ߹þ¤ß¤Ïɸ½à½ÐÎÏ(¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼ 1)¤Ç
176 ¹Ô¤ï¤ì¤Þ¤¹¡£
177 ¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Ê¤«¤Ã¤¿¾ì¹ç¤ÏºîÀ®¤µ¤ì¤Þ¤¹¡£¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤¿¾ì¹ç¤Ï
178 ¥µ¥¤¥º 0 ¤ËÀÚ¤êµÍ¤á¤é¤ì¤Þ¤¹¡£
179 .PP
180 .\"O The general format for redirecting output is:
181 ½ÐÎϤΥê¥À¥¤¥ì¥¯¥È¤Ï¡¢°ìÈÌŪ¤Ë¤Ï°Ê²¼¤Î·Á¼°¤Ç¤¹:
182 .RS
183 .PP
184 [\fIn\fP]\fB>\fP\fIword\fP
185 .RE
186 .PP
187 .\"O If the redirection operator is
188 .\"O .BR > ,
189 .\"O and the
190 .\"O .B noclobber
191 .\"O option to the
192 .\"O .B set
193 .\"O builtin has been enabled, the redirection will fail if the file
194 .\"O whose name results from the expansion of \fIword\fP exists and is
195 .\"O a regular file.
196 ¥ê¥À¥¤¥ì¥¯¥È±é»»»Ò¤¬
197 .BR >
198 ¤Ç¤¢¤ê¡¢¤«¤Ä
199 .B noclobber
200 ¥ª¥×¥·¥ç¥ó¤¬ÁȤ߹þ¤ß¥³¥Þ¥ó¥É
201 .B set
202 ¤ËÂФ·¤ÆÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢\fIword\fP ¤ÎŸ³«¤ÇÆÀ¤¿¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¡¢
203 ¤«¤Ä¤½¤ì¤¬Ä̾ï¥Õ¥¡¥¤¥ë¤Ê¤é¤Ð¡¢¥ê¥À¥¤¥ì¥¯¥È¤Ï¼ºÇÔ¤·¤Þ¤¹¡£
204 .\"O If the redirection operator is
205 .\"O .BR >| ,
206 .\"O or the redirection operator is
207 .\"O .B >
208 .\"O and the
209 .\"O .B noclobber
210 .\"O option to the
211 .\"O .B set
212 .\"O builtin command is not enabled, the redirection is attempted even
213 .\"O if the file named by \fIword\fP exists.
214 ¥ê¥À¥¤¥ì¥¯¥È±é»»»Ò¤¬
215 .BR >|
216 ¤Î¾ì¹ç¤ä¡¢
217 ¥ê¥À¥¤¥ì¥¯¥È±é»»»Ò¤¬
218 .B >
219 ¤ÇÁȤ߹þ¤ß¥³¥Þ¥ó¥É
220 .B set
221 ¤ËÂФ¹¤ë
222 .B noclobber
223 ¥ª¥×¥·¥ç¥ó¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢\fIword\fP ¤È¤¤¤¦Ì¾Á°¤Î¥Õ¥¡¥¤¥ë¤¬
224 ¸ºß¤·¤Æ¤¤¤Æ¤â¥ê¥À¥¤¥ì¥¯¥È¤¬»î¤ß¤é¤ì¤Þ¤¹¡£
225 .\"O .SS Appending Redirected Output
226 .SS ¥ê¥À¥¤¥ì¥¯¥È¤Ë¤è¤ëÄɲýÐÎÏ
227 .PP
228 .\"O Redirection of output in this fashion
229 .\"O causes the file whose name results from
230 .\"O the expansion of
231 .\"O .I word
232 .\"O to be opened for appending on file descriptor
233 .\"O .IR n ,
234 .\"O or the standard output (file descriptor 1) if
235 .\"O .I n
236 .\"O is not specified.  If the file does not exist it is created.
237 ¤³¤Î·Á¼°¤ò»È¤Ã¤Æ½ÐÎϤΥê¥À¥¤¥ì¥¯¥È¤ò¹Ô¤¦¤È¡¢
238 .I word
239 ¤òŸ³«¤·¤¿·ë²Ì¤Î̾Á°¤ò»ý¤Ä¥Õ¥¡¥¤¥ë¤¬¥ª¡¼¥×¥ó¤µ¤ì¡¢¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼
240 .IR n
241 ¤ËÂФ¹¤ë½ÐÎϤ¬¤³¤Î¥Õ¥¡¥¤¥ë¤ËÄɲ䵤ì¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£
242 .I n
243 ¤ò»ØÄꤷ¤Ê¤±¤ì¤Ð¡¢É¸½à½ÐÎÏ(¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼ 1)¤ÇÄɲ䵤ì¤Þ¤¹¡£
244 ¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Ê¤±¤ì¤Ð¡¢¿·¤·¤¯ºî¤é¤ì¤Þ¤¹¡£
245 .PP
246 .\"O The general format for appending output is:
247 ÄɲýÐÎϤϰìÈÌŪ¤Ë¤Ï°Ê²¼¤Î·Á¼°¤Ç¤¹:
248 .RS
249 .PP
250 [\fIn\fP]\fB>>\fP\fIword\fP
251 .RE
252 .PP
253 .\"O .SS Redirecting Standard Output and Standard Error
254 .SS É¸½à½ÐÎϤÈɸ½à¥¨¥é¡¼½ÐÎϤΥê¥À¥¤¥ì¥¯¥È
255 .PP
256 .\"O .B Bash
257 .\"O allows both the
258 .\"O standard output (file descriptor 1) and
259 .\"O the standard error output (file descriptor 2)
260 .\"O to be redirected to the file whose name is the
261 .\"O expansion of
262 .\"O .I word
263 .\"O with this construct.
264 .B bash
265 ¤Ç¤Ï¤³¤Î¹½Â¤¤ò»È¤Ã¤Æ¡¢É¸½à½ÐÎÏ(¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼ 1)¤Èɸ½à¥¨¥é¡¼½ÐÎÏ
266 (¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼ 2)¤ÎξÊý¤ò¡¢
267 .I word
268 ¤òŸ³«¤·¤ÆÆÀ¤¿Ì¾Á°¤ò»ý¤Ä¥Õ¥¡¥¤¥ë¤Ë¥ê¥À¥¤¥ì¥¯¥È¤µ¤»¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
269 .PP
270 .\"O There are two formats for redirecting standard output and
271 .\"O standard error:
272 ɸ½à½ÐÎϤÈɸ½à¥¨¥é¡¼½ÐÎϤËÂФ¹¤ë·Á¼°¤Ï 2 ¤Ä¤¢¤ê¤Þ¤¹:
273 .RS
274 .PP
275 \fB&>\fP\fIword\fP
276 .RE
277 .\"O and
278 ¤ª¤è¤Ó
279 .RS
280 \fB>&\fP\fIword\fP
281 .RE
282 .PP
283 .\"O Of the two forms, the first is preferred.
284 .\"O This is semantically equivalent to
285 ξ¼Ô¤Î¤¦¤Á˾¤Þ¤·¤¤¤Î¤ÏÁ°¼Ô¤ÎÊý¤Ç¤¹¡£¤³¤ì¤Ï¼¡¤Î¤â¤Î¤ÈƱ¤¸°ÕÌ£¤Ç¤¹:
286 .RS
287 .PP
288 \fB>\fP\fIword\fP 2\fB>&\fP1
289 .RE
290 .\"O .SS Here Documents
291 .SS ¥Ò¥¢¥É¥­¥å¥á¥ó¥È(Here Documents)
292 .PP
293 .\"O This type of redirection instructs the shell to read input from the
294 .\"O current source until a line containing only
295 .\"O .I word
296 .\"O (with no trailing blanks)
297 .\"O is seen.  All of
298 .\"O the lines read up to that point are then used as the standard
299 .\"O input for a command.
300 ¤³¤Î¥¿¥¤¥×¤Î¥ê¥À¥¤¥ì¥¯¥È¤Ï¸½ºß¤Î¥½¡¼¥¹¤«¤éÆþÎϤòÆɤ߹þ¤à¤è¤¦¤Ë
301 ¥·¥§¥ë¤Ë»Ø¼¨¤·¤Þ¤¹¡£¤³¤ÎÆɤ߹þ¤ß¤Ï
302 .I word
303 ¤òñÆȤǴޤà¹Ô(ËöÈø¤Ë¥Ö¥é¥ó¥¯Ê¸»ú¤¬¤¢¤Ã¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó)¤¬¸½¤ï¤ì¤ë¤Þ¤Ç
304 ¹Ô¤ï¤ì¤Þ¤¹¡£¤½¤ÎÉôʬ¤Þ¤Ç¤ËÆɤ߹þ¤ó¤À¹Ô¤ÏÁ´¤Æ¤¢¤ë¥³¥Þ¥ó¥É¤ËÂФ¹¤ë
305 ɸ½àÆþÎϤȤ·¤Æ»È¤ï¤ì¤Þ¤¹¡£
306 .PP
307 .\"O The format of here-documents is as follows:
308 ¥Ò¥¢¥É¥­¥å¥á¥ó¥È¤Î·Á¼°¤ò°Ê²¼¤Ë¼¨¤·¤Þ¤¹:
309 .RS
310 .PP
311 .nf
312 \fB<<\fP[\fB\-\fP]\fIword\fP
313         \fIhere\-document\fP
314 \fIdelimiter\fP
315 .fi
316 .RE
317 .PP
318 .\"O No parameter expansion, command substitution, arithmetic expansion,
319 .\"O or pathname expansion is performed on
320 .\"O .IR word .
321 .IR word
322 ¤ËÂФ¹¤ë¥Ñ¥é¥á¡¼¥¿Å¸³«¡¢¥³¥Þ¥ó¥ÉÃÖ´¹¡¢»»½Ñ¼°Å¸³«¡¢¥Ñ¥¹Ì¾Å¸³«¤Ï
323 Á´¤¯¹Ô¤ï¤ì¤Þ¤»¤ó¡£
324 .\"O If any characters in
325 .\"O .I word
326 .\"O are quoted, the
327 .\"O .I delimiter
328 .\"O is the result of quote removal on
329 .\"O .IR word ,
330 .\"O and the lines in the here-document are not expanded.
331 .I word
332 ¤¬°ìÉô¤Ç¤â¥¯¥©¡¼¥È¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢
333 .I delimiter
334 ¤Ë¤Ï
335 .IR word
336 ¤Î¥¯¥©¡¼¥È¤òºï½ü¤·¤¿·ë²Ì¤ò»ÈÍѤ·¡¢
337 ¥Ò¥¢¥É¥­¥å¥á¥ó¥È¤Ë´Þ¤Þ¤ì¤ë¹Ô¤ÎŸ³«¤Ï¹Ô¤ï¤ì¤Þ¤»¤ó¡£
338 .\"O If \fIword\fP is unquoted,
339 .\"O all lines of the here-document are subjected to parameter expansion,
340 .\"O command substitution, and arithmetic expansion.  In the latter
341 .\"O case, the character sequence
342 .\"O .B \e<newline>
343 .\"O is ignored, and
344 .\"O .B \e
345 .\"O must be used to quote the characters
346 .\"O .BR \e ,
347 .\"O .BR $ ,
348 .\"O and
349 .\"O .BR ` .
350 \fIword\fP ¤¬¥¯¥©¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¡¢¥Ò¥¢¥É¥­¥å¥á¥ó¥ÈÃæ¤ÎÁ´¤Æ¤Î¹Ô¤Ë
351 ÂФ·¤Æ¥Ñ¥é¥á¡¼¥¿Å¸³«¡¢¥³¥Þ¥ó¥ÉÃÖ´¹¡¢»»½Ñ¼°Å¸³«¤¬¹Ô¤ï¤ì¤Þ¤¹¡£
352 ¸å¼Ô¤Î¾ì¹ç¤Ë¤Ï¡¢
353 .B \e<newline>
354 ¤ÎÁȤ߹ç¤ï¤»¤Ï̵»ë¤µ¤ì¡¢
355 .BR \e ,
356 .BR $ ,
357 .BR `
358 ¤ò¥¯¥©¡¼¥È¤¹¤ë¤¿¤á¤Ë¤Ï
359 .B \e
360 ¤ò»È¤ï¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£
361 .PP
362 .\"O If the redirection operator is
363 .\"O .BR <<\- ,
364 .\"O then all leading tab characters are stripped from input lines and the
365 .\"O line containing
366 .\"O .IR delimiter .
367 ¥ê¥À¥¤¥ì¥¯¥È±é»»»Ò¤¬
368 .BR <<\-
369 ¤Ê¤é¤Ð¡¢¹ÔƬ¤Ë¤¢¤ë¥¿¥Öʸ»ú¤ÏÁ´¤ÆÆþÎϹԤª¤è¤Ó
370 .IR delimiter
371 ¤ò´Þ¤à¹Ô¤«¤é¼è¤ê½ü¤«¤ì¤Þ¤¹¡£
372 .\"O This allows
373 .\"O here-documents within shell scripts to be indented in a
374 .\"O natural fashion.
375 ¤³¤ì¤Ë¤è¤ê¡¢¥·¥§¥ë¥¹¥¯¥ê¥×¥ÈÃæ¤Î¥Ò¥¢¥É¥­¥å¥á¥ó¥È¤ò¼«Á³¤Ê·Á¤Ç¥¤¥ó¥Ç¥ó¥È
376 ¤µ¤»¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
377 .\"O .SS "Duplicating File Descriptors"
378 .SS ¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼¤ÎÊ£À½
379 .PP
380 .\"O The redirection operator
381 ¥ê¥À¥¤¥ì¥¯¥È±é»»»Ò
382 .RS
383 .PP
384 [\fIn\fP]\fB<&\fP\fIword\fP
385 .RE
386 .PP
387 .\"O is used to duplicate input file descriptors.
388 ¤ò»È¤Ã¤ÆÆþÎÏ¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼¤òÊ£À½¤Ç¤­¤Þ¤¹¡£
389 .\"O If
390 .\"O .I word
391 .\"O expands to one or more digits, the file descriptor denoted by
392 .\"O .I n
393 .\"O is made to be a copy of that file descriptor.
394 .I word
395 ¤¬ 1 ·å°Ê¾å¤Î¿ôÃͤËŸ³«¤µ¤ì¤¿¾ì¹ç¡¢
396 .I n
397 ¤Ç¼¨¤µ¤ì¤ë¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼¤¬À¸À®¤µ¤ì¡¢
398 ¤½¤Î¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼¤Î¥³¥Ô¡¼¤È¤Ê¤ê¤Þ¤¹¡£
399 .\"O If the digits in
400 .\"O .I word
401 .\"O do not specify a file descriptor open for input, a redirection error occurs.
402 .I word
403 ¤Ë´Þ¤Þ¤ì¤ë¿ôÃͤ¬ÆþÎϤΤ¿¤á¤Ë¥ª¡¼¥×¥ó¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼¤ò
404 »Ø¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢¥ê¥À¥¤¥ì¥¯¥È¡¦¥¨¥é¡¼¤¬µ¯¤­¤Þ¤¹¡£
405 .\"O If
406 .\"O .I word
407 .\"O evaluates to
408 .\"O .BR \- ,
409 .\"O file descriptor
410 .\"O .I n
411 .\"O is closed.  If
412 .\"O .I n
413 .\"O is not specified, the standard input (file descriptor 0) is used.
414 .I word
415 ¤òɾ²Á¤·¤¿·ë²Ì¤¬
416 .BR \-
417 ¤È¤Ê¤Ã¤¿¾ì¹ç¡¢¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼
418 .I n
419 ¤Ï¥¯¥í¡¼¥º¤µ¤ì¤Þ¤¹¡£
420 .I n
421 ¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢É¸½àÆþÎÏ(¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼ 0)¤¬»È¤ï¤ì¤Þ¤¹¡£
422 .PP
423 .\"O The operator
424 ƱÍͤˡ¢±é»»»Ò
425 .RS
426 .PP
427 [\fIn\fP]\fB>&\fP\fIword\fP
428 .RE
429 .PP
430 .\"O is used similarly to duplicate output file descriptors.  If
431 .\"O .I n
432 .\"O is not specified, the standard output (file descriptor 1) is used.
433 ¤ò»È¤Ã¤Æ½ÐÎÏ¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼¤òÊ£À½¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
434 .I n
435 ¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¡¢É¸½à½ÐÎÏ(¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼ 1)¤¬»È¤ï¤ì¤Þ¤¹¡£
436 .\"O If the digits in
437 .\"O .I word
438 .\"O do not specify a file descriptor open for output, a redirection error occurs.
439 .\"O As a special case, if \fIn\fP is omitted, and \fIword\fP does not
440 .\"O expand to one or more digits, the standard output and standard
441 .\"O error are redirected as described previously.
442 .I word
443 ¤Ë´Þ¤Þ¤ì¤ë¿ôÃͤ¬¡¢½ÐÎϤΤ¿¤á¤Ë¥ª¡¼¥×¥ó¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼¤ò
444 »Ø¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢¥ê¥À¥¤¥ì¥¯¥È¡¦¥¨¥é¡¼¤¬µ¯¤­¤Þ¤¹¡£ÆÃÊ̤ʾì¹ç¤Ç¤¹¤¬¡¢
445 \fIn\fP ¤¬¾Êά¤µ¤ì¡¢¤«¤Ä \fIword\fP ¤¬ 1 ·å°Ê¾å¤Î¿ô»ú¤Ë¤ÏŸ³«¤µ¤ì¤Ê¤«¤Ã
446 ¤¿¾ì¹ç¡¢Á°¤ËÀâÌÀ¤·¤¿¤è¤¦¤Ëɸ½à½ÐÎϤÈɸ½à¥¨¥é¡¼½ÐÎϤ¬¥ê¥À¥¤¥ì¥¯¥È¤µ¤ì¤Þ¤¹¡£
447 .\"O .SS "Opening File Descriptors for Reading and Writing"
448 .SS Æɤ߽ñ¤­¤Î¤¿¤á¤Î¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼¤Î¥ª¡¼¥×¥ó
449 .PP
450 .\"O The redirection operator
451 ¥ê¥À¥¤¥ì¥¯¥È±é»»»Ò¤¬
452 .RS
453 .PP
454 [\fIn\fP]\fB<>\fP\fIword\fP
455 .RE
456 .PP
457 .\"O causes the file whose name is the expansion of
458 .\"O .I word
459 .\"O to be opened for both reading and writing on file descriptor
460 .\"O .IR n ,
461 .\"O or on file descriptor 0 if
462 .\"O .I n
463 .\"O is not specified.  If the file does not exist, it is created.
464 ¤Ê¤é¤Ð¡¢
465 .I word
466 ¤òŸ³«¤·¤¿·ë²Ì¤Î̾Á°¤ò»ý¤Ä¥Õ¥¡¥¤¥ë¤¬¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼
467 .IR n
468 ¤Ç¤ÎÆɤ߽ñ¤­¤Î¤¿¤á¤Ë¥ª¡¼¥×¥ó¤µ¤ì¤Þ¤¹¡£
469 .I n
470 ¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¡¢¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼ 0 ¤ÇÆɤ߽ñ¤­¤¬¹Ô¤ï¤ì¤Þ¤¹¡£
471 ¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Ê¤±¤ì¤Ð¡¢¿·¤·¤¯À¸À®¤µ¤ì¤Þ¤¹¡£
472 .\"O .SH ALIASES
473 .SH ¥¨¥¤¥ê¥¢¥¹
474 .\"O \fIAliases\fP allow a string to be substituted for a word when it is used
475 .\"O as the first word of a simple command.
476 \fI¥¨¥¤¥ê¥¢¥¹(alias)\fP ¤ò»È¤¦¤È¡¢¤¢¤ëñ¸ì¤¬Ã±½ã¤Ê¥³¥Þ¥ó¥É¤ÎÀèƬ¤Î
477 ñ¸ì¤È¤·¤Æ»È¤ï¤ì¤¿¾ì¹ç¤Ë¡¢¤³¤Îʸ»úÎó¤òÊ̤Îñ¸ì¤ËÃÖ´¹¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
478 .\"O The shell maintains a list of aliases that may be set and unset with the
479 .\"O .B alias
480 .\"O and
481 .\"O .B unalias
482 .\"O builtin commands (see
483 .\"O .SM
484 .\"O .B SHELL BUILTIN COMMANDS
485 .\"O below).
486 ¥·¥§¥ë¤Ï¥¨¥¤¥ê¥¢¥¹¤Î¥ê¥¹¥È¤ò´ÉÍý¤·¤Æ¤¤¤Þ¤¹¡£
487 ¤³¤Î¥ê¥¹¥È¤ÏÁȤ߹þ¤ß¥³¥Þ¥ó¥É¤Î
488 .B alias
489 ¤È
490 .B unalias
491 ¤ò»È¤Ã¤ÆÀßÄꤪ¤è¤ÓÀßÄê¤Î¼è¤ê¾Ã¤·¤ò¹Ô¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹(¸å½Ò¤Î
492 .SM
493 .B ¥·¥§¥ë¤ÎÁȤ߹þ¤ß¥³¥Þ¥ó¥É
494 ¤ò»²¾È)¡£
495 .\"O The first word of each command, if unquoted,
496 .\"O is checked to see if it has an
497 .\"O alias.  If so, that word is replaced by the text of the alias.
498 ³Æ¥³¥Þ¥ó¥É¤ÎºÇ½é¤Îñ¸ì¤¬¥¯¥©¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢
499 ¥¨¥¤¥ê¥¢¥¹¤«¤É¤¦¤«³Îǧ¤µ¤ì¡¢¥¨¥¤¥ê¥¢¥¹¤Ê¤é¤Ð¤½¤Îñ¸ì¤Ï
500 ¤½¤Î¥¨¥¤¥ê¥¢¥¹¤Î¥Æ¥­¥È¥¹¤ÈÃÖ´¹¤µ¤ì¤Þ¤¹¡£
501 .\"O The alias name and the replacement text may contain any valid
502 .\"O shell input, including the
503 .\"O .I metacharacters
504 .\"O listed above, with the exception that the alias name may not
505 .\"O contain \fI=\fP.  The first word of the replacement text is tested
506 .\"O for aliases, but a word that is identical to an alias being expanded
507 .\"O is not expanded a second time.  This means that one may alias
508 .\"O .B ls
509 .\"O to
510 .\"O .BR "ls \-F" ,
511 .\"O for instance, and
512 .\"O .B bash
513 .\"O does not try to recursively expand the replacement text.
514 ¥¨¥¤¥ê¥¢¥¹Ì¾¤ÈÃÖ´¹¤µ¤ì¤ë¥Æ¥­¥¹¥È¤Ë¤Ï¡¢¥·¥§¥ë¤ÎÆþÎϤȤ·¤ÆÍ­¸ú¤Ê¤â¤Î¤Ï²¿
515 ¤Ç¤â´Þ¤á¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤³¤ì¤Ë¤ÏÀè¤Ëµó¤²¤¿
516 .I ¥á¥¿Ê¸»ú
517 ¤â´Þ¤Þ¤ì¤Þ¤¹¤¬¡¢¥¨¥¤¥ê¥¢¥¹Ì¾¤Ë¤Ï \fI=\fP ¤ò´Þ¤á¤ë¤³¤È¤¬¤Ç¤­¤Ê¤¤¤È¤¤¤¦
518 Îã³°¤¬¤¢¤ê¤Þ¤¹¡£ÃÖ´¹¤µ¤ì¤ë¥Æ¥­¥¹¥È¤ÎºÇ½é¤Îñ¸ì¤Ï¥¨¥¤¥ê¥¢¥¹¤ò
519 ɾ²Á¤µ¤ì¤Þ¤¹¤¬¡¢ºÇ½é¤Îñ¸ì¤¬Å¸³«¤µ¤ì¤ë¥¨¥¤¥ê¥¢¥¹¤ÈƱ¤¸¾ì¹ç¤Ë¤Ï¡¢
520 Ÿ³«¤Ï 1ÅÙ¤·¤«¹Ô¤ï¤ì¤Þ¤»¤ó¡£¤Ä¤Þ¤ê¡¢
521 .B ls
522 ¤¬
523 .BR "ls \-F"
524 ¤Î¥¨¥¤¥ê¥¢¥¹¤È¤Ê¤Ã¤Æ¤¤¤ë¤è¤¦¤Ê¾ì¹ç¤Ë¤Ï¡¢
525 .B bash
526 ¤ÏÃÖ´¹¤µ¤ì¤ëʸ»úÎó¤òºÆµ¢Åª¤ËŸ³«¤¹¤ë¤³¤È¤Ï¤¢¤ê¤Þ¤»¤ó¡£
527 .\"O If the last character of the alias value is a
528 .\"O .IR blank ,
529 .\"O then the next command
530 .\"O word following the alias is also checked for alias expansion.
531 ¥¨¥¤¥ê¥¢¥¹¤ÎÃͤκǸå¤Îʸ»ú¤¬
532 .IR ¥Ö¥é¥ó¥¯Ê¸»ú
533 ¤Î¾ì¹ç¡¢¥¨¥¤¥ê¥¢¥¹¤Ë³¤¯¼¡¤Î¥³¥Þ¥ó¥É¤Îñ¸ì¤ËÂФ·¤Æ¤â
534 ¥¨¥¤¥ê¥¢¥¹Å¸³«¤¬»î¤ß¤é¤ì¤Þ¤¹¡£
535 .PP
536 .\"O Aliases are created and listed with the
537 .\"O .B alias
538 .\"O command, and removed with the
539 .\"O .B unalias
540 .\"O command.
541 ¥¨¥¤¥ê¥¢¥¹¤Ï
542 .B alias
543 ¥³¥Þ¥ó¥É¤ÇºîÀ®¤È¥ê¥¹¥Èɽ¼¨¤ò¹Ô¤¤¡¢
544 .B unalias
545 ¥³¥Þ¥ó¥É¤Çºï½ü¤·¤Þ¤¹¡£
546 .PP
547 .\"O There is no mechanism for using arguments in the replacement text.
548 .\"O If arguments are needed, a shell function should be used (see
549 .\"O .SM
550 .\"O .B FUNCTIONS
551 .\"O below).
552 ÃÖ´¹¤µ¤ì¤ë¥Æ¥­¥¹¥È¤Ë°ú¤­¿ô¤òÆþ¤ì¤ë»ÅÁȤߤϤ¢¤ê¤Þ¤»¤ó¡£°ú¤­¿ô¤¬É¬Íפʤé
553 ¤Ð¡¢¥·¥§¥ë´Ø¿ô¤ò»È¤ï¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó(¸å½Ò¤Î
554 .SM
555 .B ´Ø¿ô
556 ¤ò»²¾È)
557 .PP
558 .\"O Aliases are not expanded when the shell is not interactive, unless
559 .\"O the
560 .\"O .B expand_aliases
561 .\"O shell option is set using
562 .\"O .B shopt
563 .\"O (see the description of
564 .\"O .B shopt
565 .\"O under
566 .\"O .SM
567 .\"O \fBSHELL BUILTIN COMMANDS\fP
568 .\"O below).
569 ¥·¥§¥ë¤¬ÂÐÏÃŪ¤Ç¤Ê¤¤»þ¤Ë¤Ï¡¢
570 .B shopt
571 ¥³¥Þ¥ó¥É¤ò»ÈÍѤ·¤Æ
572 .B expand_aliases
573 ¥ª¥×¥·¥ç¥ó¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¸Â¤ê¥¨¥¤¥ê¥¢¥¹¤ÎŸ³«¤Ï¹Ô¤ï¤ì¤Þ¤»¤ó(¸å½Ò¤Î
574 .SM
575 \fB¥·¥§¥ë¤ÎÁȤ߹þ¤ß¥³¥Þ¥ó¥É\fP
576 ¤Ë¤ª¤±¤ë
577 .B shopt
578 ¤ÎÀâÌÀ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤)¡£
579 .PP
580 .\"O The rules concerning the definition and use of aliases are
581 .\"O somewhat confusing.
582 ¥¨¥¤¥ê¥¢¥¹¤ÎÄêµÁ¤äÍøÍѤ˴ط¸¤¹¤ëµ¬Â§¤Ë¤Ï¡¢Ê¶¤é¤ï¤·¤¤ÅÀ¤¬¤¢¤ê¤Þ¤¹¡£
583 .\"O .B Bash
584 .\"O always reads at least one complete line
585 .\"O of input before executing any
586 .\"O of the commands on that line.  Aliases are expanded when a
587 .\"O command is read, not when it is executed.  Therefore, an
588 .\"O alias definition appearing on the same line as another
589 .\"O command does not take effect until the next line of input is read.
590 .B bash
591 ¤Ï¡¢¤¢¤ë¹Ô¤Ë½ñ¤«¤ì¤Æ¤¤¤ë¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤¹¤ëÁ°¤Ëɬ¤º¡¢¾¯¤Ê¤¯¤È¤â 1 ²ó¤Ï
592 ¹ÔÁ´ÂΤòÆɤ߹þ¤ß¤Þ¤¹¡£¥¨¥¤¥ê¥¢¥¹¤¬Å¸³«¤µ¤ì¤ë¤Î¤Ï¥³¥Þ¥ó¥É¤ò
593 Æɤ߹þ¤ó¤À»þ¤Ç¤¢¤ê¡¢¼Â¹Ô¤¹¤ë»þ¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£
594 ¤·¤¿¤¬¤Ã¤Æ¡¢Ê̤Υ³¥Þ¥ó¥É¤ÈƱ¤¸¹Ô¤Ç¥¨¥¤¥ê¥¢¥¹ÄêµÁ¤ò¹Ô¤Ã¤¿¾ì¹ç¤Ë¤Ï¡¢
595 ¼¡¤ÎÆþÎϹԤ¬Æɤ߹þ¤Þ¤ì¤ë¤Þ¤Ç¤Ï¥¨¥¤¥ê¥¢¥¹¤Î¸ú²Ì¤Ï¸½¤ï¤ì¤Þ¤»¤ó¡£
596 .\"O The commands following the alias definition
597 .\"O on that line are not affected by the new alias.
598 Ʊ¤¸¹Ô¤Ë¤¢¤ë¥¨¥¤¥ê¥¢¥¹ÄêµÁ¤Î¸å¤Î¥³¥Þ¥ó¥É¤Ï¡¢¿·¤·¤¤¥¨¥¤¥ê¥¢¥¹¤Î±Æ¶Á¤ò
599 ¼õ¤±¤Þ¤»¤ó¡£
600 .\"O This behavior is also an issue when functions are executed.
601 ¤³¤ÎÆ°ºî¤Ï´Ø¿ô¤ò¼Â¹Ô¤¹¤ë¾ì¹ç¤Ë¤âÌäÂê¤Ë¤Ê¤ê¤Þ¤¹¡£
602 .\"O Aliases are expanded when a function definition is read,
603 .\"O not when the function is executed, because a function definition
604 .\"O is itself a compound command.  As a consequence, aliases
605 .\"O defined in a function are not available until after that
606 .\"O function is executed.  To be safe, always put
607 .\"O alias definitions on a separate line, and do not use
608 .\"O .B alias
609 .\"O in compound commands.
610 ¥¨¥¤¥ê¥¢¥¹¤¬Å¸³«¤µ¤ì¤ë¤Î¤Ï´Ø¿ôÄêµÁ¤¬Æɤ߹þ¤Þ¤ì¤ë»þ¤Ç¤¢¤ê¡¢
611 ´Ø¿ô¤¬¼Â¹Ô¤µ¤ì¤ë»þ¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£
612 ¤Ê¤¼¤Ê¤é¡¢´Ø¿ôÄêµÁ¼«¿È¤âÊ£¹ç¥³¥Þ¥ó¥É¤À¤«¤é¤Ç¤¹¡£
613 ¤½¤Î·ë²Ì¤È¤·¤Æ¡¢´Ø¿ôÆâ¤ÇÄêµÁ¤µ¤ì¤¿¥¨¥¤¥ê¥¢¥¹¤Ï¡¢¤½¤Î´Ø¿ô¤Î¼Â¹Ô¤µ¤ì¤ë¤Þ¤Ç¤Ï
614 ÍøÍѤǤ­¤Þ¤»¤ó¡£°ÂÁ´¤Î¤¿¤á¡¢¥¨¥¤¥ê¥¢¥¹ÄêµÁ¤ÏÆÈΩ¤·¤¿¹Ô¤Ç¹Ô¤¦¤Ù¤­¤Ç¤¹¡£
615 Ê£¹ç¥³¥Þ¥ó¥ÉÆâ¤Ç
616 .B alias
617 ¤ò»È¤Ã¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£
618 .PP
619 .\"O For almost every purpose, aliases are superseded by
620 .\"O shell functions.
621 ¤Û¤È¤ó¤ÉÁ´¤Æ¤Î¾ì¹ç¤Ë¡¢¥¨¥¤¥ê¥¢¥¹¤ÎÂå¤ï¤ê¤Ë¥·¥§¥ë´Ø¿ô¤ò»È¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£