According to the Bash man pages,
Contains the name of a file in the same format as /etc/hosts that should be read when the shell needs to complete a hostname. The list of possible hostname completions may be changed while the shell is running; the next time hostname completion is attempted after the value is changed, bash adds the contents of the new file to the existing list. If HOSTFILE is set, but has no value, bash attempts to read /etc/hosts to obtain the list of possible hostname completions. When HOSTFILE is unset, the hostname list is cleared.
Here's the line in my .bashrc where HOSTFILE is set:
I opened a new bash session, created ~/.hosts, filled it with the names of servers that I wanted to expand using tab completion. then typed
expecting to get a lists of all of the hosts in ~/.hosts starting with 'p'. Bash simply beeped at me twice.
$ shopt hostcomplete
> bash --version
GNU bash, version 3.1.17(1)-release (i486-pc-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
Has anyone successfully set up hostname completion? What am I missing?