[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to get a directory's "full" name?
From: |
Robert P. J. Day |
Subject: |
Re: how to get a directory's "full" name? |
Date: |
Fri, 12 May 2006 14:12:28 -0400 (EDT) |
On Fri, 12 May 2006, Paul D. Smith wrote:
> %% "Aditya Kher" <address@hidden> writes:
>
> >> cd to arg, then echo full dir name. is there a simpler or built-in
> >> way that's better?
>
> ak> the unix command dirname gives the directory name
> ak> see also basename for getting file name in a similar manner
>
> dirname and basename are simply string munchers: they break up
> strings on "/" etc. They do NOT evaluate their arguments to find
> fully-qualified pathnames.
>
> In addition, the make functions $(dir ...), $(notdir ...),
> $(basename ...), etc. are much better/faster for this kind of thing,
> as long as you don't need to work on a shell variable.
actually, i'm pretty sure that's *exactly* what i need to do. in the
context of your multi-arch build, i want the user to be able to
specify the build directory, not based on that funky calculation of
yours, but with a directory name of any acceptable format:
$ make BUILDDIR=/tmp
$ make BUILDDIR=subdir (relative to where i am now)
$ make BUILDDIR=s1/../s2/../s3
and have all of those work. i'll take a look at those make functions
but i know that at least i can do it with that hacky macro i posted
earlier. speed is not a critical factor here.
rday