Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Resolving absolute path of named directory
- X-seq: zsh-users 17599
- From: Jesper Nygårds <jesper.nygards@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Resolving absolute path of named directory
- Date: Tue, 22 Jan 2013 09:50:14 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=mZgyud8Imf5JvfCC1hT0XH7tCH2VrF2zq9sFbO43WDY=; b=HnZf7nx8+osL2atE8gOLZjAXvjtQaeyzfdqAAJneoiNNi1yow2LdKvqrg4de+ks4HY sxAgGEV1KS4guCB/Q68ovPaH8EXQ/qax3OUeFQqfgjrg2BHyQPuULHcxKWs2EhJaqSBz srxDdG+axTvqRHdJm3qdJ4rq06kKZvJOupogc2tmVl+dSEjFONA9AaqSzabP+sukA4EP QF5ip9XuOJ83rdzw/ewY9RpnL+3Lf1tL/pVGs9Sv/4AFQrK9H7kQWfO2uZUw5QEHno7e joJjKPNAIWoaoumG4U6sPsf/YxnsjAFWxLXJFYSnpXfpF/O7A6S+mxAC3STuKcIFC50J 1Afw==
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
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