zsh-users
 help / color / mirror / code / Atom feed
From: "Thomas Köhler" <jean-luc@picard.franken.de>
To: zsh-users@zsh.org
Subject: Re: Resolving absolute path of named directory
Date: Tue, 22 Jan 2013 11:14:40 +0100	[thread overview]
Message-ID: <20130122101440.GA8372@picard.franken.de> (raw)
In-Reply-To: <CABZhJg9s03XqHkxgehAF+pVsZHfwz+0tw5T7jyLc8uM0=_LNNA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1303 bytes --]

Hi,

Jesper Nygårds wrote:
> 
> 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?

I expect what you want is not
  % pr=~/projects
  % mydir="~pr"
but
  % pr=~/projects
  % mydir="$pr"
instead. Or you might want
  % mydir=~/projects
  % print ${mydir:a}


Ciao,
Thomas

-- 
 Thomas Köhler       Email:       jean-luc@picard.franken.de
     <><             WWW:              http://gott-gehabt.de
                     IRC: tkoehler       Freenode: thkoehler
                     PGP public key available from Homepage!

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2013-01-22 10:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-22  8:50 Jesper Nygårds
2013-01-22 10:14 ` Thomas Köhler [this message]
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=20130122101440.GA8372@picard.franken.de \
    --to=jean-luc@picard.franken.de \
    --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).