OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / GNU_bash / work / P09
1 .\"O .SH HISTORY
2 .SH ÍúÎò(HISTORY)
3 .\"O When the
4 .\"O .B \-o history
5 .\"O option to the
6 .\"O .B set
7 .\"O builtin is enabled, the shell provides access to the
8 .\"O \fIcommand history\fP,
9 .\"O the list of commands previously typed.
10 .B \-o history
11 ¥ª¥×¥·¥ç¥ó¤òÁȤ߹þ¤ß¥³¥Þ¥ó¥É¤Î
12 .B set
13 ¤ÇÍ­¸ú¤Ë¤¹¤ë¤È¡¢
14 \fI¥³¥Þ¥ó¥ÉÍúÎò (command history)\fP (°ÊÁ°¤ËÆþÎϤ·¤¿¥³¥Þ¥ó¥É¤Î¥ê¥¹¥È)
15 ¤Ë¥¢¥¯¥»¥¹¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£
16 .\"O The value of the \fBHISTSIZE\fP variable is used as the
17 .\"O number of commands to save in a history list.
18 ÊÑ¿ô \fBHISTSIZE\fP ¤ÎÃͤ¬¡¢
19 ÍúÎò¥ê¥¹¥È¤ËÊݸ¤¹¤ë¥³¥Þ¥ó¥É¤Î¿ô¤Ë¤Ê¤ê¤Þ¤¹¡£
20 .\"WORD:        history list    ÍúÎò¥ê¥¹¥È
21 .\"O The text of the last
22 .\"O .SM
23 .\"O .B HISTSIZE
24 .\"O commands (default 500) is saved.  The shell
25 .\"O stores each command in the history list prior to parameter and
26 .\"O variable expansion (see
27 .\"O .SM
28 .\"O .B EXPANSION
29 .\"O above) but after history expansion is performed, subject to the
30 .\"O values of the shell variables
31 .\"O .SM
32 .\"O .B HISTIGNORE
33 .\"O and
34 .\"O .SM
35 .\"O .BR HISTCONTROL .
36 ²áµî¤ËÆþÎϤ·¤¿¥³¥Þ¥ó¥É¤Î¤¦¤Á¡¢ºÇ¿·
37 .SM
38 .B HISTSIZE
39 ¸Äʬ (¥Ç¥Õ¥©¥ë¥È¤Ï 500 ¸Ä) ¤Î¥Æ¥­¥¹¥È¤¬Êݸ¤µ¤ì¤Þ¤¹¡£
40 ¥·¥§¥ë¤Ï³Æ¥³¥Þ¥ó¥É¤ò¡¢¥Ñ¥é¥á¡¼¥¿Å¸³«¤äÊÑ¿ôŸ³«
41 (Á°½Ò¤Î
42 .SM
43 .B Å¸³«
44 ¤ò»²¾È) ¤ò¹Ô¤¦Á°¤Î¤«¤¿¤Á¤ÇÍúÎò¥ê¥¹¥È¤Ë³ÊǼ¤·¤Þ¤¹¡£
45 ¤¿¤À¤·¡¢ÍúÎòŸ³«¤Ï¼Â¹Ô¤·¤Æ¤«¤é³ÊǼ¤·¤Þ¤¹¡£
46 ÍúÎòŸ³«¤Ï¥·¥§¥ëÊÑ¿ô
47 .SM
48 .B HISTIGNORE
49 ¤È
50 .SM
51 .BR HISTCONTROL
52 ¤ÎÃͤ˽¾¤Ã¤Æ¼Â¹Ô¤µ¤ì¤Þ¤¹¡£
53 .PP
54 .\"O On startup, the history is initialized from the file named by
55 .\"O the variable
56 .\"O .SM
57 .\"O .B HISTFILE
58 .\"O (default \fI~/.bash_history\fP).
59 µ¯Æ°»þ¤Ë¡¢ÍúÎò¤Ï
60 .SM
61 .B HISTFILE
62 ÊÑ¿ô (¥Ç¥Õ¥©¥ë¥È¤Ï \fI~/.bash_history\fP)
63 ¤¬¼¨¤¹¥Õ¥¡¥¤¥ë¤ÎÆâÍƤǽé´ü²½¤µ¤ì¤Þ¤¹¡£
64 .\"O The file named by the value of
65 .\"O .SM
66 .\"O .B HISTFILE
67 .\"O is truncated, if necessary, to contain no more than
68 .\"O the number of lines specified by the value of
69 .\"O .SM
70 .\"O .BR HISTFILESIZE .
71 .SM
72 .B HISTFILE
73 ¤Ç»ØÄꤵ¤ì¤¿¥Õ¥¡¥¤¥ë¤Ï¡¢
74 .SM
75 .B HISTFILESIZE
76 ¤Ç»ØÄꤵ¤ì¤¿¹Ô¿ô¤ò±Û¤¨¤Ê¤¤¤è¤¦¤Ë¡¢É¬Íפ˱þ¤¸¤ÆÀÚ¤êµÍ¤á¤é¤ì¤Þ¤¹¡£
77 .\"O When an interactive shell exits, the last
78 .\"O .SM
79 .\"O .B HISTSIZE
80 .\"O lines are copied from the history list to
81 .\"O .SM
82 .\"O .BR HISTFILE .
83 ÂÐÏÃŪ¤Ê¥·¥§¥ë¤¬½ªÎ»¤¹¤ëºÝ¤Ë¤Ï¡¢ºÇ¶á¤Î
84 .SM
85 .B HISTSIZE
86 ¸Ä¤Î¹Ô¤¬ÍúÎò¥ê¥¹¥È¤«¤é
87 .SM
88 .B HISTFILE
89 ¤Ë¥³¥Ô¡¼¤µ¤ì¤Þ¤¹¡£
90 .\"O If the
91 .\"O .B histappend
92 .\"O shell option is enabled
93 .\"O (see the description of
94 .\"O .B shopt
95 .\"O under
96 .\"O .SM
97 .\"O .B "SHELL BUILTIN COMMANDS"
98 .\"O below), the lines are appended to the history file,
99 .\"O otherwise the history file is overwritten.
100 ¥·¥§¥ë¥ª¥×¥·¥ç¥ó¤Î
101 .B histappend
102 (
103 .SM
104 .B ¥·¥§¥ë¤ÎÁȤ߹þ¤ß¥³¥Þ¥ó¥É
105 ¤Î¹à¤Î
106 .B shopt
107 ¤ÎÀâÌÀ¤ò»²¾È) ¤¬Í­¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤È¡¢
108 ¤³¤ì¤é¤Î¹Ô¤ÏÍúÎò¥Õ¥¡¥¤¥ë¤ÎËöÈø¤ËÄɲ䵤ì¤Þ¤¹¡£
109 ¤³¤Î¥ª¥×¥·¥ç¥ó¤¬Ìµ¸ú¤Ê¤é¤Ð¡¢ÍúÎò¥Õ¥¡¥¤¥ë¤Ï¾å½ñ¤­¤µ¤ì¤Þ¤¹¡£
110 .\"O If
111 .\"O .SM
112 .\"O .B HISTFILE
113 .\"O is unset, or if the history file is unwritable, the history is
114 .\"O not saved.  After saving the history, the history file is truncated
115 .\"O to contain no more than
116 .\"O .SM
117 .\"O .B HISTFILESIZE
118 .\"O lines.  If
119 .\"O .SM
120 .\"O .B HISTFILESIZE
121 .\"O is not set, no truncation is performed.
122 .SM
123 .B HISTFILE
124 ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¤«¡¢ÍúÎò¥Õ¥¡¥¤¥ë¤¬½ñ¤­¹þ¤á¤Ê¤¤¾õÂÖ¤À¤È¡¢
125 ÍúÎò¤ÏÊݸ¤µ¤ì¤Þ¤»¤ó¡£
126 ÍúÎò¤ÎÊݸ¤ò¹Ô¤Ã¤¿¸å¤Ë¤Ï¡¢ÍúÎò¥Õ¥¡¥¤¥ë¤Ï¹Ô¿ô¤¬
127 .SM
128 .B HISTFILESIZE
129 ¹Ô¤ò±Û¤¨¤Ê¤¤¤è¤¦¤ËÀÚ¤êµÍ¤á¤é¤ì¤Þ¤¹¡£
130 .SM
131 .B HISTFILESIZE
132 ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¡¢ÀÚ¤êµÍ¤á¤Ï¹Ô¤ï¤ì¤Þ¤»¤ó¡£
133 .PP
134 .\"O The builtin command
135 .\"O .B fc
136 .\"O (see
137 .\"O .SM
138 .\"O .B SHELL BUILTIN COMMANDS
139 .\"O below) may be used to list or edit and re-execute a portion of
140 .\"O the history list.
141 ÁȤ߹þ¤ß¥³¥Þ¥ó¥É
142 .B fc
143 (¸å½Ò¤Î
144 .SM
145 .B ¥·¥§¥ë¤ÎÁȤ߹þ¤ß¥³¥Þ¥ó¥É
146 ¤ò»²¾È) ¤òÍѤ¤¤ë¤È¡¢ÍúÎò¥ê¥¹¥È¤Î°ìÉô¤ò¥ê¥¹¥È¡¦ÊÔ½¸¤·¤ÆºÆ¼Â¹Ô¤Ç¤­¤Þ¤¹¡£
147 .\"O The
148 .\"O .B history
149 .\"O builtin may be used to display or modify the history list and
150 .\"O manipulate the history file.
151 .\"O When using command-line editing, search commands
152 .\"O are available in each editing mode that provide access to the
153 .\"O history list.
154 ÁȤ߹þ¤ß¥³¥Þ¥ó¥É¤Î
155 .B history
156 ¤òÍѤ¤¤ë¤È¡¢ÍúÎò¥ê¥¹¥È¤òɽ¼¨¡¦ÊÔ½¸¤·¤¿¤ê¡¢
157 ÍúÎò¥Õ¥¡¥¤¥ë¤òÁàºî¤Ç¤­¤Þ¤¹¡£
158 ¥³¥Þ¥ó¥É¥é¥¤¥ó¤òÊÔ½¸¤¹¤ëºÝ¤Ë¤Ï¡¢
159 ³ÆÊÔ½¸¥â¡¼¥É¤Ç¤¤¤í¤¤¤í¤Ê¸¡º÷¥³¥Þ¥ó¥É¤¬ÍøÍѤǤ­¡¢
160 ÍúÎò¥ê¥¹¥È¤Ø¥¢¥¯¥»¥¹¤Ç¤­¤Þ¤¹¡£
161 .PP
162 .\"O The shell allows control over which commands are saved on the history
163 .\"O list.  The
164 .\"O .SM
165 .\"O .B HISTCONTROL
166 .\"O and
167 .\"O .SM
168 .\"O .B HISTIGNORE
169 .\"O variables may be set to cause the shell to save only a subset of the
170 .\"O commands entered.
171 ¤³¤Î¥·¥§¥ë¤Ç¤Ï¡¢¤É¤Î¥³¥Þ¥ó¥É¤¬ÍúÎò¥ê¥¹¥È¤ËÊݸ¤µ¤ì¤ë¤«¤òÀ©¸æ¤Ç¤­¤Þ¤¹¡£
172 .SM
173 .B HISTCONTROL
174 ÊÑ¿ô¤È
175 .SM
176 .B HISTIGNORE
177 ÊÑ¿ô¤òÀßÄꤹ¤ë¤È¡¢
178 ¥·¥§¥ë¤ÏÆþÎϤµ¤ì¤¿¥³¥Þ¥ó¥É¤Î°ìÉô¤·¤«Êݸ¤·¤Ê¤¯¤Ê¤ê¤Þ¤¹¡£
179 .\"O The
180 .\"O .B cmdhist
181 .\"O shell option, if enabled, causes the shell to attempt to save each
182 .\"O line of a multi-line command in the same history entry, adding
183 .\"O semicolons where necessary to preserve syntactic correctness.
184 ¥·¥§¥ë¥ª¥×¥·¥ç¥ó¤Î
185 .B cmdhist
186 ¤òÍ­¸ú¤Ë¤¹¤ë¤È¡¢¥·¥§¥ë¤ÏÊ£¿ô¹Ô¤ËÊ̤ì¤Æ¤¤¤ë¥³¥Þ¥ó¥É¤Î³Æ¹Ô¤ò
187 Ʊ¤¸ÍúÎò¥¨¥ó¥È¥ê¤ËÊݸ¤·¤è¤¦¤È¤·¤Þ¤¹¡£
188 ¤³¤ÎºÝ¤Ë¤Ï¡¢Ê¸Ë¡Åª¤ÊÀµ¤·¤µ¤òÊݤĤ¿¤á¤Ë¥»¥ß¥³¥í¥ó¤¬É¬Íפ˱þ¤¸¤ÆÄɲ䵤ì¤Þ¤¹¡£
189 .\"O The
190 .\"O .B lithist
191 .\"O shell option causes the shell to save the command with embedded newlines
192 .\"O instead of semicolons.  See the description of the
193 .\"O .B shopt
194 .\"O builtin below under
195 .\"O .SM
196 .\"O .B "SHELL BUILTIN COMMANDS"
197 .\"O for information on setting and unsetting shell options.
198 ¥·¥§¥ë¥ª¥×¥·¥ç¥ó¤Î
199 .B lithist
200 ¤òÍ­¸ú¤Ë¤¹¤ë¤È¡¢¤³¤Î¥·¥§¥ë¤Ï¹Ô¤ÎÅÓÃæ¤Ë
201 ¥»¥ß¥³¥í¥ó¤Ç¤Ï¤Ê¤¯²þ¹Ôʸ»ú¤òÃÖ¤¯·Á¤Ç¥³¥Þ¥ó¥É¤òÊݸ¤·¤Þ¤¹¡£
202 ¥·¥§¥ë¥ª¥×¥·¥ç¥ó¤ÎÀßÄê¤ÈÀßÄê¼è¤ê¾Ã¤·¤Ë¤Ä¤¤¤Æ¤Ï¡¢¸å½Ò¤Î
203 .SM
204 .B ¥·¥§¥ë¤ÎÁȤ߹þ¤ß¥³¥Þ¥ó¥É
205 ¤Ë¤ª¤±¤ëÀâÌÀ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
206 .\"O .SH "HISTORY EXPANSION"
207 .SH ÍúÎò¤ÎŸ³«
208 .PP
209 .\"O The shell supports a history expansion feature that
210 .\"O is similar to the history expansion in
211 .\"O .BR csh.
212 .\"O This section describes what syntax features are available.  This
213 .\"O feature is enabled by default for interactive shells, and can be
214 .\"O disabled using the
215 .\"O .B \+H
216 .\"O option to the
217 .\"O .B set
218 .\"O builtin command (see
219 .\"O .SM
220 .\"O .B SHELL BUILTIN COMMANDS
221 .\"O below).  Non-interactive shells do not perform history expansion
222 .\"O by default.
223 ¤³¤Î¥·¥§¥ë¤Ï¡¢
224 .B csh
225 ¤ÎÍúÎòŸ³«¤ÈƱ¤¸¤è¤¦¤Êµ¡Ç½¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤¹¡£
226 ¤³¤Î¥»¥¯¥·¥ç¥ó¤Ç¤Ï¡¢ÍúÎòŸ³«¤Ç»ÈÍѤǤ­¤ëµ­Ë¡¡¦µ¡Ç½¤òÀâÌÀ¤·¤Þ¤¹¡£
227 ¤³¤Îµ¡Ç½¤ÏÂÐÏÃŪ¥·¥§¥ë¤Ê¤é¤Ð¥Ç¥Õ¥©¥ë¥È¤ÇÍ­¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¤¬¡¢
228 ÁȤ߹þ¤ß¥³¥Þ¥ó¥É
229 .B set
230 ¤Î
231 .B \+H
232 ¥ª¥×¥·¥ç¥ó (¸å½Ò¤Î
233 .SM
234 .B ¥·¥§¥ë¤ÎÁȤ߹þ¤ß¥³¥Þ¥ó¥É
235 ¤ò»²¾È) ¤Ç̵¸ú¤Ë¤Ç¤­¤Þ¤¹¡£
236 ÈóÂÐÏÃŪ¥·¥§¥ë¤Î¾ì¹ç¤Ï¡¢¥Ç¥Õ¥©¥ë¥È¤Ç¤ÏÍúÎòŸ³«¤Ï¹Ô¤ï¤ì¤Þ¤»¤ó¡£
237 .PP
238 .\"O History expansions introduce words from the history list into
239 .\"O the input stream, making it easy to repeat commands, insert the
240 .\"O arguments to a previous command into the current input line, or
241 .\"O fix errors in previous commands quickly.
242 ÍúÎòŸ³«¤Ï¡¢ÍúÎò¥ê¥¹¥ÈÃæ¤Îñ¸ì¤òÆþÎÏ¥¹¥È¥ê¡¼¥à¤ËÆþ¤ì¤Þ¤¹¡£
243 ¤³¤Îµ¡Ç½¤òÍøÍѤ¹¤ë¤È¡¢¥³¥Þ¥ó¥É¤ò·«¤êÊÖ¤·¤¿¤ê¡¢
244 Á°¤Î¥³¥Þ¥ó¥É¤Ç»ØÄꤷ¤¿¥ª¥×¥·¥ç¥ó¤ò¸½ºß¤ÎÆþÎϹԤËÁÞÆþ¤·¤¿¤ê¡¢
245 Á°¤Î¥³¥Þ¥ó¥É¤Î¸í¤ê¤ò¼êÁ᤯ľ¤·¤¿¤ê¡¢
246 ¤È¤¤¤Ã¤¿¤³¤È¤¬´Êñ¤Ë¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£
247 .PP
248 .\"O History expansion is performed immediately after a complete line
249 .\"O is read, before the shell breaks it into words.
250 .\"O It takes place in two parts.
251 .\"O The first is to determine which line from the history list
252 .\"O to use during substitution.
253 .\"O The second is to select portions of that line for inclusion into
254 .\"O the current one.
255 ÍúÎòŸ³«¤¬¼Â¹Ô¤µ¤ì¤ë¤Î¤ÏÆþÎϹÔÁ´ÂΤòÆɤ߹þ¤ó¤Àľ¸å¤Ç¤¢¤ê¡¢
256 ¥·¥§¥ë¤¬¹Ô¤òñ¸ì¤Ëʬ³ä¤¹¤ë¤è¤ê¤âÁ°¤Ç¤¹¡£
257 ÍúÎòŸ³«¤ÎÆ°ºî¤Ï 2 Ãʳ¬¤Ç¹Ô¤ï¤ì¤Þ¤¹¡£
258 ¤Þ¤ººÇ½é¤Ë¡¢ÃÖ´¹¤Ë»È¤¦¹Ô¤òÍúÎò¥ê¥¹¥È¤«¤éÁª¤Ó¤Þ¤¹¡£
259 ¼¡¤Ë¡¢¤½¤Î¹Ô¤Î¤É¤ÎÉôʬ¤ò¸½ºß¤Î¹Ô¤Ë½ñ¤­¹þ¤à¤«¤òÁªÂò¤·¤Þ¤¹¡£
260 .\"O The line selected from the history is the \fIevent\fP,
261 .\"O and the portions of that line that are acted upon are \fIwords\fP.
262 .\"O Various \fImodifiers\fP are available to manipulate the selected words.
263 ÍúÎò¥ê¥¹¥È¤«¤éÁª¤Ð¤ì¤¿¹Ô¤Ï\fI¥¤¥Ù¥ó¥È (event)\fP ¤È¸Æ¤Ð¤ì¡¢
264 ¤³¤Î¹Ô¤Î¤¦¤ÁÆ°ºî¤ÎÂоݤȤʤëÉôʬ¤ò\fIñ¸ìÎó (words)\fP¤È¸Æ¤Ó¤Þ¤¹¡£
265 ÍÍ¡¹¤Ê\fI½¤¾þ»Ò (modifier)\fP ¤¬ÍøÍѤǤ­¡¢
266 ÁªÂò¤µ¤ì¤¿Ã±¸ìÎó¤ÎÁàºî¤¬²Äǽ¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
267 .\"O The line is broken into words in the same fashion as when reading input,
268 .\"O so that several \fImetacharacter\fP-separated words surrounded by
269 .\"O quotes are considered one word.
270 ¹Ô¤Îñ¸ì¤Ø¤Îʬ³ä¤ÏÆþÎϤòÆɤ߹þ¤à»þ¤ÈƱ¤¸¤è¤¦¤Ë¹Ô¤ï¤ì¤ë¤Î¤Ç¡¢
271 \fI¥á¥¿Ê¸»ú\fP¤Ç¶èÀÚ¤é¤ì¤¿Ê£¿ô¤Îñ¸ì¤ò¥¯¥©¡¼¥È¤Ç³ç¤Ã¤¿¤â¤Î¤Ï
272 1 ¤Ä¤Îñ¸ì¤È¸«¤Ê¤µ¤ì¤Þ¤¹¡£
273 .\"O History expansions are introduced by the appearance of the
274 .\"O history expansion character, which is \^\fB!\fP\^ by default.
275 .\"O Only backslash (\^\fB\e\fP\^) and single quotes can quote
276 .\"O the history expansion character.
277 ÍúÎòŸ³«¤¬¹Ô¤ï¤ì¤ë¤Î¤Ï¡¢ÍúÎòŸ³«Ê¸»ú¤¬¸½¤ï¤ì¤¿»þ¤Ç¤¹¡£
278 ÍúÎòŸ³«Ê¸»ú¤Ï¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï \^\fB!\fP\^ ¤Ç¤¹¡£
279 ÍúÎòŸ³«Ê¸»ú¤ò¥¯¥©¡¼¥È¤Ç¤­¤ë¤Î¤Ï¡¢
280 ¥Ð¥Ã¥¯¥¹¥é¥Ã¥·¥å (\^\fB\e\fP\^) ¤È¥·¥ó¥°¥ë¥¯¥©¡¼¥È¤À¤±¤Ç¤¹¡£
281 .PP
282 .\"O Several shell options settable with the
283 .\"O .B shopt
284 .\"O builtin may be used to tailor the behavior of history expansion.
285 ÁȤ߹þ¤ß¥³¥Þ¥ó¥É¤Î
286 .B shopt
287 ¤òÍѤ¤¤Æ¡¢²¿¼ïÎफ¤¢¤ë¥·¥§¥ë¥ª¥×¥·¥ç¥ó¤òÀßÄꤹ¤ë¤È¡¢
288 ÍúÎòŸ³«¤ÎÆ°ºî¤òÄ´À°¤Ç¤­¤Þ¤¹¡£
289 .\"O If the
290 .\"O .B histverify
291 .\"O shell option is enabled (see the description of the
292 .\"O .B shopt
293 .\"O builtin), and
294 .\"O .B readline
295 .\"O is being used, history substitutions are not immediately passed to
296 .\"O the shell parser.
297 ¥·¥§¥ë¥ª¥×¥·¥ç¥ó¤Î
298 .B histverify
299 ¤¬Í­¸ú¤Ç (ÁȤ߹þ¤ß¥³¥Þ¥ó¥É
300 .B shopt
301 ¤ÎÀâÌÀ¤ò»²¾È)¡¢¤«¤Ä
302 .B readline
303 ¤¬»È¤ï¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¡¢
304 ÍúÎòÃÖ´¹¤ò¹Ô¤Ã¤¿·ë²Ì¤Ï¤¹¤°¤Ë¤Ï¥·¥§¥ë¤Î¥Ñ¡¼¥¶¤ËÅϤµ¤ì¤Þ¤»¤ó¡£
305 .\"O Instead, the expanded line is reloaded into the
306 .\"O .B readline
307 .\"O editing buffer for further modification.
308 Ÿ³«¤µ¤ì¤¿¹Ô¤Ï
309 .B readline
310 ¤ÎÊÔ½¸¥Ð¥Ã¥Õ¥¡¤ËºÆ¤ÓÆɤ߹þ¤Þ¤ì¡¢¤µ¤é¤ËÊÔ½¸¤¬¹Ô¤¨¤ë¾õÂ֤ˤʤê¤Þ¤¹¡£
311 .\"O If
312 .\"O .B readline
313 .\"O is being used, and the
314 .\"O .B histreedit
315 .\"O shell option is enabled, a failed history substitution will be reloaded
316 .\"O into the
317 .\"O .B readline
318 .\"O editing buffer for correction.
319 .B readline
320 ¤ò»ÈÍѤ·¤Æ¤ª¤ê¡¢¤«¤Ä¥·¥§¥ë¥ª¥×¥·¥ç¥ó¤Î
321 .B histreedit
322 ¤¬Í­¸ú¤Ç¤¢¤ë¾ì¹ç¡¢ÍúÎòÃÖ´¹¤¬¼ºÇÔ¤·¤Æ¤â¤½¤Î·ë²Ì¤Ï
323 .B readline
324 ¤ÎÊÔ½¸¥Ð¥Ã¥Õ¥¡¤ËºÆ¤ÓÆɤ߹þ¤Þ¤ì¡¢ÄûÀµ¤Ç¤­¤ë¾õÂ֤Ȥʤê¤Þ¤¹¡£
325 .\"O The
326 .\"O .B \-p
327 .\"O option to the
328 .\"O .B history
329 .\"O builtin command may be used to see what a history expansion will
330 .\"O do before using it.
331 ÁȤ߹þ¤ß¥³¥Þ¥ó¥É
332 .B history
333 ¤Î
334 .B \-p
335 ¥ª¥×¥·¥ç¥ó¤ò»È¤¦¤È¡¢¼ÂºÝ¤ËÍúÎòŸ³«¤ò¹Ô¤¦Á°¤Ë¡¢
336 ¤É¤Î¤è¤¦¤ËŸ³«¤µ¤ì¤ë¤Î¤«¤ò¸«¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
337 .\"O The
338 .\"O .B \-s
339 .\"O option to the
340 .\"O .B history
341 .\"O builtin may be used to add commands to the end of the history list
342 .\"O without actually executing them, so that they are available for
343 .\"O subsequent recall.
344 ÁȤ߹þ¤ß¥³¥Þ¥ó¥É
345 .B history
346 ¤Î
347 .B \-s
348 ¥ª¥×¥·¥ç¥ó¤ò»È¤¦¤È¡¢
349 ¥³¥Þ¥ó¥É¤òÍúÎò¥ê¥¹¥È¤ÎËöÈø¤Ë (¼ÂºÝ¤Î¼Â¹Ô¤Ï¤»¤º¤Ë) ÄɲäǤ­¤Þ¤¹¡£
350 Äɲä·¤¿¥³¥Þ¥ó¥É¤Ï¡¢¸å¤ÇºÆ¸Æ¤Ó½Ð¤·¤Ç¤­¤Þ¤¹¡£
351 .PP
352 .\"O The shell allows control of the various characters used by the
353 .\"O history expansion mechanism (see the description of
354 .\"O .B histchars
355 .\"O above under
356 .\"O .BR "Shell Variables" ).
357 ¤³¤Î¥·¥§¥ë¤Ç¤Ï¡¢ÍúÎòŸ³«µ¡¹½¤Ç»È¤¦¤¤¤í¤¤¤í¤Êʸ»ú¤òÀ©¸æ¤Ç¤­¤Þ¤¹
358 (Á°½Ò¤Î
359 .BR ¥·¥§¥ëÊÑ¿ô
360 ¤Î¹àÌܤˤª¤±¤ë
361 .B histchars
362 ¤ÎÀâÌÀ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤)¡£
363 .\"O .SS Event Designators
364 .SS ¥¤¥Ù¥ó¥È»Ø¼¨»Ò (Event Designator)
365 .PP
366 .\"O An event designator is a reference to a command line entry in the
367 .\"O history list.
368 ¥¤¥Ù¥ó¥È»Ø¼¨»Ò¤Ï¡¢
369 ÍúÎò¥ê¥¹¥ÈÃæ¤Î¥³¥Þ¥ó¥É¥é¥¤¥ó¥¨¥ó¥È¥ê¤ò»²¾È¤¹¤ë¤â¤Î¤Ç¤¹¡£
370 .PP
371 .PD 0
372 .TP
373 .B !
374 .\"O Start a history substitution, except when followed by a
375 .\"O .BR blank ,
376 .\"O newline, = or (.
377 ÍúÎòÃÖ´¹¤ò³«»Ï¤·¤Þ¤¹¡£¤¿¤À¤·¡¢\fB¥Ö¥é¥ó¥¯Ê¸»ú\fR¡¢
378 ²þ¹Ôʸ»ú¡¢=, ( ¤Î¤¤¤º¤ì¤«¤¬¸å¤Ë³¤¯¾ì¹ç¤Ï½ü¤­¤Þ¤¹¡£
379 .TP
380 .B !\fIn\fR
381 .\"O Refer to command line
382 .\"O .IR n .
383 .I n
384 ¹ÔÌܤΥ³¥Þ¥ó¥É¥é¥¤¥ó¤ò»²¾È¤·¤Þ¤¹¡£
385 .TP
386 .B !\-\fIn\fR
387 .\"O Refer to the current command line minus
388 .\"O .IR n .
389 ¸½ºß¤«¤é
390 .I n
391 ¹ÔÁ°¤Î¥³¥Þ¥ó¥É¥é¥¤¥ó¤ò»²¾È¤·¤Þ¤¹¡£
392 .TP
393 .B !!
394 .\"O Refer to the previous command.  This is a synonym for `!\-1'.
395 1 ¹ÔÁ°¤Î¥³¥Þ¥ó¥É¥é¥¤¥ó¤ò»²¾È¤·¤Þ¤¹¡£`!\-1' ¤ÈƱµÁ¤Ç¤¹¡£
396 .TP
397 .B !\fIstring\fR
398 .\"O Refer to the most recent command starting with 
399 .\"O .IR string .
400 .I string
401 ¤Ç»Ï¤Þ¤ë¥³¥Þ¥ó¥É¤Î¤¦¤Á¡¢°ìÈÖ¸½ºß¤Ë¶á¤¤¤È¤³¤í¤Ç¼Â¹Ô¤·¤¿¤â¤Î¤ò»²¾È¤·¤Þ¤¹¡£
402 .TP
403 .B !?\fIstring\fR\fB[?]\fR
404 .\"O Refer to the most recent command containing
405 .\"O .IR string .
406 .\"O The trailing \fB?\fP may be omitted if
407 .\"O .I string
408 .\"O is followed immediately by a newline.
409 .I string
410 ¤ò´Þ¤à¥³¥Þ¥ó¥É¤Î¤¦¤Á¡¢°ìÈÖ¸½ºß¤Ë¶á¤¤¤È¤³¤í¤Ç¼Â¹Ô¤·¤¿¤â¤Î¤ò»²¾È¤·¤Þ¤¹¡£
411 .I string
412 ¤Îľ¸å¤¬²þ¹Ôʸ»ú¤Ê¤é¤Ð¡¢ºÇ¸å¤Î \fB?\fP ¤Ï¾Êά¤·¤Æ¤â¹½¤¤¤Þ¤»¤ó¡£
413 .TP
414 .B \d\s+2^\s-2\u\fIstring1\fP\d\s+2^\s-2\u\fIstring2\fP\d\s+2^\s-2\u
415 .\"O Quick substitution.  Repeat the last command, replacing
416 .\"O .I string1
417 .\"O with
418 .\"O .IR string2 .
419 .\"O Equivalent to
420 .\"O ``!!:s/\fIstring1\fP/\fIstring2\fP/''
421 .\"O (see \fBModifiers\fP below).
422 ´Ê°×ÃÖ´¹¡£
423 .I string1
424 ¤ò
425 .IR string2
426 ¤ËÃÖ´¹¤·¤ÆľÁ°¤Î¥³¥Þ¥ó¥É¤ò·«¤êÊÖ¤·¤Þ¤¹¡£
427 ``!!:s/\fIstring1\fP/\fIstring2\fP/'' ¤ÈƱµÁ¤Ç¤¹
428 (¸å½Ò¤Î\fB½¤¾þ»Ò\fP¤ò»²¾È)¡£
429 .TP
430 .B !#
431 .\"O The entire command line typed so far.
432 º£¤Þ¤Ç¤Î¤È¤³¤í¤Þ¤Ç¤ËÂǤÁ¹þ¤ó¤À¥³¥Þ¥ó¥É¥é¥¤¥óÁ´ÂΤǤ¹¡£
433 .PD
434 .\"O .SS Word Designators
435 .SS Ã±¸ì»Ø¼¨»Ò(Word Designators)
436 .PP
437 .\"O Word designators are used to select desired words from the event.
438 .\"O A 
439 .\"O .B :
440 .\"O separates the event specification from the word designator.
441 .\"O It may be omitted if the word designator begins with a
442 .\"O .BR ^ ,
443 .\"O .BR $ ,
444 .\"O .BR * ,
445 .\"O .BR \- ,
446 .\"O or
447 .\"O .BR % .
448 .\"O Words are numbered from the beginning of the line,
449 .\"O with the first word being denoted by 0 (zero).
450 .\"O Words are inserted into the current line separated by single spaces.
451 ñ¸ì»Ø¼¨»Ò (word designator) ¤Ï¡¢
452 ¥¤¥Ù¥ó¥È¤«¤éÍߤ·¤¤Ã±¸ì¤òÁª¤Ö»þ¤ËÍѤ¤¤é¤ì¤Þ¤¹¡£
453 ¥¤¥Ù¥ó¥È»ØÄê¤Èñ¸ì»Ø¼¨»Ò¤Î¥»¥Ñ¥ì¡¼¥¿¤Ë¤Ï
454 .B :
455 ¤òÍѤ¤¤Þ¤¹¡£
456 ñ¸ì»Ø¼¨»Ò¤¬
457 .BR ^ ,
458 .BR $ ,
459 .BR * ,
460 .BR \- ,
461 .B %
462 ¤Î¤¤¤º¤ì¤«¤Ç»Ï¤Þ¤ë¾ì¹ç¤Ë¤Ï¡¢¤³¤Î¥»¥Ñ¥ì¡¼¥¿¤Ï¾Êά¤Ç¤­¤Þ¤¹¡£
463 ñ¸ì¤Ë¤Ï¹Ô¤ÎÀèƬ¤«¤éÈֹ椬¿¶¤é¤ì¤Þ¤¹¡£
464 ÀèƬ¤Îñ¸ì¤¬ 0 ÈÖÌܤˤʤê¤Þ¤¹¡£
465 ñ¸ì¤Ï¸½ºß¤Î¹Ô¤Ë¡¢¶õÇò 1 ¤Ä¤Ç¶èÀÚ¤é¤ì¤ÆÁÞÆþ¤µ¤ì¤Þ¤¹¡£
466 .PP
467 .PD 0
468 .TP
469 .\"O .B 0 (zero)
470 .B 0 (¥¼¥í)
471 .\"O The zeroth word.  For the shell, this is the command
472 .\"O word.
473 0 ÈÖÌܤÎñ¸ì¡£¤³¤Î¥·¥§¥ë¤Ë¤È¤Ã¤Æ¤Ï¡¢¤³¤ì¤Ï¥³¥Þ¥ó¥É¤òɽ¤¹Ã±¸ì¤Ç¤¹¡£
474 .TP
475 .I n
476 .\"O The \fIn\fRth word.
477 \fIn\fR ÈÖÌܤÎñ¸ì¡£
478 .TP
479 .B ^
480 .\"O The first argument.  That is, word 1.
481 ºÇ½é¤Î°ú¤­¿ô¡£¤Ä¤Þ¤ê 1 ÈÖÌܤÎñ¸ì¤Ç¤¹¡£
482 .TP
483 .B $
484 .\"O The last argument.
485 ºÇ¸å¤Î°ú¤­¿ô¡£
486 .TP
487 .B %
488 .\"O The word matched by the most recent `?\fIstring\fR?' search.
489 `?\fIstring\fR?' ¸¡º÷¤Ë¥Þ¥Ã¥Á¤¹¤ë¡¢°ìÈÖ¸½ºß¤Ë¶á¤¤Ã±¸ì¡£
490 .TP
491 .I x\fB\-\fPy
492 .\"O A range of words; `\-\fIy\fR' abbreviates `0\-\fIy\fR'.
493 ñ¸ì¤ÎÈÏ°Ï¡£`0\-\fIy\fR' ¤Î¾Êά·Á¤È¤·¤Æ `\-\fIy\fR' ¤¬»È¤¨¤Þ¤¹¡£
494 .TP
495 .B *
496 .\"O All of the words but the zeroth.  This is a synonym
497 .\"O for `\fI1\-$\fP'.  It is not an error to use
498 .\"O .B *
499 .\"O if there is just one
500 .\"O word in the event; the empty string is returned in that case.
501 0 ÈÖÌܤò½ü¤¯Á´¤Æ¤Îñ¸ì¡£¤³¤ì¤Ï `\fI1\-$\fP' ¤ÎÊÌɽ¸½¤Ç¤¹¡£
502 ¥¤¥Ù¥ó¥ÈÃæ¤Ë 1 ¤Ä¤·¤«Ã±¸ì¤¬¸½¤ï¤ì¤Ê¤¤¤È¤­¤Ë
503 .B *
504 ¤ò»È¤Ã¤Æ¤â¥¨¥é¡¼¤Ë¤Ï¤Ê¤ê¤Þ¤»¤ó¡£
505 ¤³¤Î¤è¤¦¤Ê¾ì¹ç¤Ë¤Ï¶õʸ»úÎó¤¬ÊÖ¤µ¤ì¤Þ¤¹¡£
506 .TP
507 .B x*
508 .\"O Abbreviates \fIx\-$\fP.
509 \fIx\-$\fP ¤Î¾Êά·Á¤Ç¤¹¡£
510 .TP
511 .B x\-
512 .\"O Abbreviates \fIx\-$\fP like \fBx*\fP, but omits the last word.
513 \fBx*\fP ¤ÈƱÍͤˠ\fIx\-$\fP ¤Î¾Êά·Á¤Ç¤¹¤¬¡¢
514 ¤¿¤À¤·ºÇ¸å¤Îñ¸ì¤Ï´Þ¤ß¤Þ¤»¤ó¡£
515 .PD
516 .PP
517 .\"O If a word designator is supplied without an event specification, the
518 .\"O previous command is used as the event.
519 ¥¤¥Ù¥ó¥È»ØÄê¤Ê¤·¤Ëñ¸ì»Ø¼¨»Ò¤¬Í¿¤¨¤é¤ì¤¿¾ì¹ç¡¢
520 ľÁ°¤Î¥³¥Þ¥ó¥É¤¬¥¤¥Ù¥ó¥È¤È¤·¤Æ»È¤ï¤ì¤Þ¤¹¡£
521 .\"O .SS Modifiers
522 .SS ½¤¾þ»Ò(Modifiers)
523 .PP
524 .\"O After the optional word designator, there may appear a sequence of
525 .\"O one or more of the following modifiers, each preceded by a `:'.
526 ñ¸ì»Ø¼¨»Ò (¾Êά²Äǽ) ¤Î¸å¤Ë¤Ï¡¢
527 °Ê²¼¤Ë¼¨¤¹½¤¾þ»Ò¤ò¡¢1 ¸Ä°Ê¾å¤Î¥·¡¼¥±¥ó¥¹¤Î¤«¤¿¤Á¤ÇÃÖ¤¯¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
528 ¤½¤ì¤¾¤ì¤Î½¤¾þ»Ò¤ÎÁ°¤Ë¤Ï `:' ¤ò¤Ä¤±¤Þ¤¹¡£
529 .PP
530 .PD 0
531 .PP
532 .TP
533 .B h
534 .\"O Remove a trailing file name component, leaving only the head.
535 ¥Ñ¥¹Ì¾¤«¤éËöÈø¤Ë¤¢¤ëÉôʬ (¥Õ¥¡¥¤¥ë̾) ¤ò¼è¤ê½ü¤­¡¢
536 Á°¤ÎÊý (¥Ç¥£¥ì¥¯¥È¥êÉô) ¤À¤±¤ò»Ä¤·¤Þ¤¹¡£
537 .TP
538 .B t
539 .\"O Remove all leading file name components, leaving the tail.
540 ¥Ñ¥¹Ì¾¤«¤éÁ°¤ÎÊý (¥Ç¥£¥ì¥¯¥È¥êÉô) ¤ò¼è¤ê½ü¤­¡¢
541 ËöÈø¤Ë¤¢¤ëÉôʬ (¥Õ¥¡¥¤¥ë̾) ¤À¤±¤ò»Ä¤·¤Þ¤¹¡£
542 .TP
543 .B r
544 .\"O Remove a trailing suffix of the form \fI.xxx\fP, leaving the
545 .\"O basename.
546 ËöÈø¤Ë¤¢¤ë \fI.xxx\fP ·Á¼°¤Î¥µ¥Õ¥£¥Ã¥¯¥¹¤ò¼è¤ê½ü¤­¡¢
547 ¥Ù¡¼¥¹Ì¾ (basename) ¤À¤±¤ò»Ä¤·¤Þ¤¹¡£
548 .TP
549 .B e
550 .\"O Remove all but the trailing suffix.
551 ËöÈø¤Î¥µ¥Õ¥£¥Ã¥¯¥¹¤À¤±¤ò»Ä¤·¤Æ¡¢Á´¤Æ¤ÎÉôʬ¤ò¼è¤ê½ü¤­¤Þ¤¹¡£
552 .TP
553 .B p
554 .\"O Print the new command but do not execute it.
555 ¿·¤·¤¤¥³¥Þ¥ó¥É¤òɽ¼¨¤·¤Þ¤¹¤¬¡¢¼Â¹Ô¤Ï¤·¤Þ¤»¤ó¡£
556 .TP
557 .B q
558 .\"O Quote the substituted words, escaping further substitutions.
559 ÃÖ´¹¤¬¹Ô¤ï¤ì¤¿Ã±¸ì¤ò¥¯¥©¡¼¥È¤·¡¢¤½¤ì°Ê¾å¤ÎÃÖ´¹¤¬¹Ô¤ï¤ì¤Ê¤¤¤è¤¦¤Ë¤·¤Þ¤¹¡£
560 .TP
561 .B x
562 .\"O Quote the substituted words as with
563 .\"O .BR q ,
564 .\"O but break into words at
565 .\"O .B blanks
566 .\"O and newlines.
567 .B q
568 ¤ÈƱ¤¸¤è¤¦¤ËÃÖ´¹¸å¤Îñ¸ì¤ò¥¯¥©¡¼¥È¤·¤Þ¤¹¤¬¡¢
569 .B ¶õÇòʸ»ú
570 ¤È²þ¹Ôʸ»ú¤Î¤È¤³¤í¤Çñ¸ì¤Ëʬ³ä¤·¤Þ¤¹¡£
571 .TP
572 .B s/\fIold\fP/\fInew\fP/
573 .\"O Substitute
574 .\"O .I new
575 .\"O for the first occurrence of
576 .\"O .I old
577 .\"O in the event line.  Any delimiter can be used in place of /.  The
578 .\"O final delimiter is optional if it is the last character of the
579 .\"O event line.  The delimiter may be quoted in
580 .\"O .I old
581 .\"O and
582 .\"O .I new
583 .\"O with a single backslash.  If & appears in
584 .\"O .IR new ,
585 .\"O it is replaced by
586 .\"O .IR old .
587 ¥¤¥Ù¥ó¥È¹Ô¤ÇºÇ½é¤Ë¸½¤ï¤ì¤¿
588 .I old
589 ¤ò
590 .I new
591 ¤ËÃÖ¤­´¹¤¨¤Þ¤¹¡£/ ¤ÎÂå¤ï¤ê¤ËǤ°Õ¤Î¶èÀÚ¤êʸ»ú¤ò»È¤¦¤³¤È¤â¤Ç¤­¤Þ¤¹¡£
592 ºÇ¸å¤Î¶èÀÚ¤êʸ»ú¤¬¥¤¥Ù¥ó¥È¹Ô¤ÎºÇ¸å¤Îʸ»ú¤Ê¤é¤Ð¡¢
593 ¤³¤ì¤Ï¾Êά¤Ç¤­¤Þ¤¹¡£
594 .I old
595 ¤È
596 .I new
597 ¤ÎÃæ¤Ç¤Ï¡¢
598 ¥Ð¥Ã¥¯¥¹¥é¥Ã¥·¥å 1 ¤Ä¤Ç¥¯¥©¡¼¥È¤¹¤ì¤Ð¶èÀÚ¤êʸ»ú¤â»È¤¨¤Þ¤¹¡£
599 .I new 
600 ¤Ë & ¤¬´Þ¤Þ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¡¢¤³¤ì¤Ï
601 .I old
602 ¤ËÃÖ¤­´¹¤¨¤é¤ì¤Þ¤¹¡£
603 .\"O A single backslash will quote the &.  If
604 .\"O .I old
605 .\"O is null, it is set to the last
606 .\"O .I old
607 .\"O substituted, or, if no previous history substitutions took place,
608 .\"O the last
609 .\"O .I string
610 .\"O in a
611 .\"O .B !?\fIstring\fR\fB[?]\fR
612 .\"O search.
613 ¥Ð¥Ã¥¯¥¹¥é¥Ã¥·¥å 1 ¤Ä¤òÁ°¤ËÃÖ¤±¤Ð & ¤ò¥¯¥©¡¼¥È¤Ç¤­¤Þ¤¹¡£
614 .I old
615 ¤¬¶õʸ»úÎó¤Ê¤é¤Ð¡¢¤³¤ì¤Ë¤ÏÁ°²ó¤ËÃÖ´¹¤µ¤ì¤¿
616 .I old
617 ¤¬ÀßÄꤵ¤ì¤Þ¤¹¡£
618 °ÊÁ°¤ËÍúÎòÃÖ´¹¤¬Á´¤¯¹Ô¤ï¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¤Ï¡¢¸½ºß¤Ë°ìÈֶᤤ
619 .B !?\fIstring\fR\fB[?]\fR
620 ¤Î¸¡º÷¤Ç»È¤ï¤ì¤¿
621 .I string
622 ¤¬ÀßÄꤵ¤ì¤Þ¤¹¡£
623 .TP
624 .B &
625 .\"O Repeat the previous substitution.
626 ľÁ°¤ÎÃÖ´¹¤ò·«¤êÊÖ¤·¤Þ¤¹¡£
627 .TP
628 .B g
629 .\"O Cause changes to be applied over the entire event line.  This is
630 .\"O used in conjunction with `\fB:s\fP' (e.g., `\fB:gs/\fIold\fP/\fInew\fP/\fR')
631 .\"O or `\fB:&\fP'.  If used with
632 .\"O `\fB:s\fP', any delimiter can be used
633 .\"O in place of /, and the final delimiter is optional
634 .\"O if it is the last character of the event line.
635 Êѹ¹¤ò¥¤¥Ù¥ó¥È¹ÔÁ´ÂΤËŬÍѤ·¤Þ¤¹¡£
636 ¤³¤ì¤Ï `\fB:s\fP' ¤ÈÁȤ߹ç¤ï¤»¤Æ»È¤ï¤ì¤Þ¤¹
637 (Îã:`\fB:gs/\fIold\fP/\fInew\fP/\fR')¡£
638 `\fB:s\fP' ¤È°ì½ï¤Ë»È¤Ã¤¿¾ì¹ç¤Ë¤Ï¡¢
639 / ¤ÎÂå¤ï¤ê¤ËǤ°Õ¤Î¶èÀÚ¤êʸ»ú¤ò»È¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
640 ¤Þ¤¿ºÇ¸å¤Î¶èÀÚ¤êʸ»ú¤¬¥¤¥Ù¥ó¥È¹Ô¤ÎºÇ¸å¤Îʸ»ú¤Ê¤é¤Ð¡¢
641 ¤³¤ì¤Ï¾Êά¤Ç¤­¤Þ¤¹¡£
642 .PD