Bash file completion, symbolic links and pwd confusion

[prev] [thread] [next] [lurker] [Date index for 2007/02/01]

From: Robert Rothenberg
Subject: Bash file completion, symbolic links and pwd confusion
Date: 16:20 on 01 Feb 2007
Note the following session:

 me@nix:~$ mkdir foo
 me@nix:~$ mkdir foo/bar
 me@nix:~$ mkdir foo/feh
 me@nix:~$ mkdir baz
 me@nix:~$ mkdir baz/bo
 me@nix:~$ cd baz
 me@nix:~/baz$ ln -s ../foo/bar
 me@nix:~/baz$ cd bar
 me@nix:~/baz/bar$ ls ../bo

Bash file completion works as one expects. I'm in "baz/bar". That's even
what pwd says:

 me@nix:~/baz/bar$ pwd
 /home/me/baz/bar

So ".." should refer to "baz".  But when I run that ls command

  ls: ../bo: No such file or directory

Because ls knows it's really in "foo/bar", not "baz/bar"

  me@nix:~/baz/bar$ ls ..
  bar  feh

I understand that there are good reasons for this behaviour on the part of
commands like ls.  But why can't bash's file completion behave consistently
with everything else?

Generated at 03:01 on 02 Feb 2007 by mariachi 0.52