A gotcha with Bash on Ubuntu 8.04
Suppose that you have an Ubuntu 8.04 system where you have opted to make
/bin/sh be bash, the way it used to be in 6.06, and you have an account
with /bin/sh as the login shell (for example, you created it with plain
useradd). So you log in to the account and everything seems normal and
bash-y, until you try to do filename completion and get:
$ cd /-sh: <( compgen -d -- '/' ): No such file or directory
(The text in bold is what you typed before you hit <TAB>.)
I'll give you the fix first: use
chsh to change your shell to be
/bin/bash. Then everything will work right.
This is one of those interestingly misleading error messages, although if you read very carefully Bash is actually sort of telling you what is going on. Let me give you a related example:
$ cat < 'a random name'
sh: a random name: No such file or directory
This error message has the same form as the first one but makes it much more obvious what the shell is complaining about.
For filename completion, what seems to be going on is that when Bash is
operating in sh-compatible mode as a login shell, it is bash-like enough
to cause the Ubuntu 8.04 default dotfiles to load the bash command
line completion shell functions, but those functions use Bash-specific
syntax. As a result, Bash in sh-compatible mode interprets the
command seen in the error message as one giant redirection and, of
course, cannot find such a peculiarly named file.
(I spent a long time being confused by the error message because I
didn't read it carefully and thus didn't realize that it was complaining
about a failed redirection instead of a failure to find
Short summary: this is an Ubuntu 8.04 bug caused by them not expecting
/bin/sh to be Bash and to be used as a login shell, although this is a
theoretically supported configuration. This doesn't really surprise me;
we've had plenty of experience to the effect that Ubuntu goes off the
rails when you depart from their one standard configuration.