Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Why doesn't tab expand .



On 2006-10-09 at 19:15 +0000, zzapper wrote:
> Why doesn't tab expand . ?

To what?

"." is a directory, the "self" directory.  It's not an alias or special
to the shell in any way.  It's a directory entry which exists in every
directory, provided as part of the filesystem interface by the kernel;
on Unix-biased filesystems, it typically actually exists in the
filesystem.  Without anything else, it's of course interpreted relative
to the current working directory.

If you view a directory as a file containing mappings from filenames to
inodes (the actual file structure on disk), then the filesystem
hierarchies exist from some inodes pointed-to also being directories.
Every directory contains items called "." and ".."; "." points to the
directory itself, ".." to the parent (which is why you can't hardlink a
directory to be in two locations (anymore)).

/usr/./bin/./foo is valid and the same as /usr/bin/foo but with some
extra checks in there.

So "." is a valid filename, referencing a directory; since there's no
'/' anywhere, it's the '.' which exists in $PWD, and effectively the
same as $PWD for most intents and purposes.

> > cp /tmp/fred.txt .<Tab>
> 
> Be useful in a few cases?

Try $PWD<tab>

Regards,
-Phil



Messages sorted by: Reverse Date, Date, Thread, Author