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

Resolving absolute path of named directory



Say I have a string containing a directory name. I know I can use the :a
modifier to turn the string into the absolute path, but this does not seem
to work with named directories, and if I read the documentation correctly,
it's not supposed to. I wonder how I can go about resolving the string if
it is a named directory.

Here's an example of what I mean:
% pwd
/c/Program/Java
% ls
jdk16  jdk17  jre6  jre7
% mydir="jre6"
% print ${mydir:a}
/c/Program/Java/jre6       # Expexted
% pr=~/projects
% mydir="~pr"
% print ${mydir:a}
/c/Program/Java/~pr        # What I wanted was "/home/jesper/projects"

So, in the above example, is there a way to make $mydir resolve to the
absolute path of the named directory ~pr, without using an external program?


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