Читать книгу Linux Bible - Christopher Negus - Страница 100
TIP
ОглавлениеTo add hostnames from an additional file, you can set the HOSTFILE
variable to the name of that file. The file must be in the same format as /etc/hosts
.
Here are a few examples of command completion. (When you see <Tab>, it means to press the Tab key on your keyboard.) Enter the following:
$ echo $OS<Tab> $ cd ~ro<Tab> $ userm<Tab>
The first example causes $OS
to expand to the $OSTYPE
variable. In the next example, ~ro
expands to the root user's home directory (~root/
). Next, userm
expands to the usermod
command.
Pressing Tab twice offers some wonderful possibilities. Sometimes, several possible completions for the string of characters you have entered are available. In those cases, you can check the possible ways that text can be expanded by pressing Tab twice at the point where you want to do completion.
The following shows the result you would get if you checked for possible completions on $P
:
$ echo $P<Tab><Tab> $PATH $PPID $PS1 $PS2 $PS4 $PWD $ echo $P
In this case, there are six possible variables that begin with $P
. After possibilities are displayed, the original command line returns, ready for you to complete it as you choose. For example, if you typed another P and hit Tab again, the command line would be completed with $PPID
(the only unique possibility).