From: "Jesper Nygårds" <jesper.nygards@gmail.com>
To: zsh-users@zsh.org
Subject: Resolving absolute path of named directory
Date: Tue, 22 Jan 2013 09:50:14 +0100 [thread overview]
Message-ID: <CABZhJg9s03XqHkxgehAF+pVsZHfwz+0tw5T7jyLc8uM0=_LNNA@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 750 bytes --]
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?
next reply other threads:[~2013-01-22 8:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-22 8:50 Jesper Nygårds [this message]
2013-01-22 10:14 ` Thomas Köhler
2013-01-22 10:58 ` Jesper Nygårds
2013-01-22 19:45 ` Peter Stephenson
2013-01-23 19:19 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CABZhJg9s03XqHkxgehAF+pVsZHfwz+0tw5T7jyLc8uM0=_LNNA@mail.gmail.com' \
--to=jesper.nygards@gmail.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).