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

Re: Usernames with dots

On Feb 14, 10:12am, Seth Underwood wrote:
} At my work, all user names have a dot (usually First.Last).  This naming
} convention causes the ~username shortcut to not work in zsh.

I think you may be mis-diagnosing the problem.  What does "to not work"
mean here, more precisely?

This man page bit that you quoted:

} Static named directories
}        A  `~'  followed  by anything not already covered consisting of any
} number of alphanumeric
}        characters or underscore (`_'), hyphen (`-'), or dot (`.') is looked
} up as a named  direc-
}        tory,  and  replaced by the value of that named directory if found.

That means that a dot is explicitly included among the characters that
may come after a tilde as part of a user name.

What does
		print -l ${(k)userdirs}
show you?

Any user names not included in that output will not be available for
tilde-expansion.  The userdirs variable is populated by querying your
operating system for available user names, so if it is incomplete then
the system is in some way preventing zsh from listing all the users.

} Is there a way in zsh to change this behavior?

I'm not sure I'm answering the right question because it's not obvious
what behavior (or lack thereof) is wrong, but you can explicitly add
the user names you care about like so:

    hash -d First.Last=/home/First.Last

Replace /home/ with the appropriate path prefix for your environment.

Other fixes (likely outside zsh) may be possible depending on whether
$userdirs is incomplete and why.

Barton E. Schaefer

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