11.4. Commenting and Filename Expansion
Filename expansion is a mechanism that allows the user to type part of a filename and press the Esc key to see the rest of the filename(s). In the following examples, [Esc] represents the Esc key.
Example 11.20.
(Press the Esc Key for [Esc].
1 $ ls a[Esc]=
1) abc
2) abc1
3) abc122
4) abc123
5) abc2
2 $ ls a[Esc]*
ls abc abc1 abc122 abc123 abc2
abc abc1 abc122 abc123 abc2
3 $ print apples pears peaches
apples pears peaches
4 $ print [Esc]_
print peaches
peaches
5 $ print apples pears peaches plums
apples pears peaches
6 $ print [Esc]2_
print pears
pears
EXPLANATION
By typing an a, followed by the Esc key and an equal sign (=), all files starting with an a are numbered and listed. (The numbers do not serve any special purpose.) By typing an a, then the Esc key and an asterisk (*), the filenames starting with an a are displayed. The print command displays its arguments: apples, pears, and peaches. The Esc key, followed by an underscore (_), is replaced with the last argument. The print command displays its arguments: apples, pears, and peaches. The Esc key, followed by the number 2 and an underscore, is replaced by the second argument. The command (print) is the first argument, starting at word zero.
|