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

Re: Absolute path of a path



2010/10/28 Vincent Lefevre <vincent@xxxxxxxxxx>:
> On 2010-10-27 18:54:17 +0200, JÃrÃmie Roquet wrote:
>> 2010/10/27 Vincent Lefevre <vincent@xxxxxxxxxx>:
>> > BTW, is there a way to get the canonicalised absolute pathname
>> > with zsh? (i.e. what the "realpath" command gives.)
>>
>> your_path(:A) I guess :)
>
> No. The zsh man path says:
>
> ÂA Â ÂAs Â`a', Âbut also resolve use of symbolic links where possible.
> Â Â Â Note that resolution of `..' occurs before Âresolution Âof Âsymâ
> Â Â Â bolic Âlinks. Â This Âcall is equivalent to a unless your system
> Â Â Â has the realpath system call (modern systems do).
>
> but Linux doesn't have a realpath system call.
>
> ypig:~> man 2 realpath
> No manual entry for realpath in section 2
>
> FYI:
>
> ypig:~> realpath symlink/../vlefevre/symlink
> /home/vlefevre
>
> ypig:~> echo symlink/../vlefevre/symlink(:A)
> /home/vlefevre/vlefevre/symlink
>
> where symlink is a symbolic link to ".".

Strange, it works for me.

$ pwd
/udir/jroquet
$ ls -l .screenrc
lrwxrwxrwx 1 jroquet kmem 37 2009-10-16 14:56 .screenrc ->
/udir/jroquet/Arkonf/screen/.screenrc
$ ls -l .screenrc(:A)
-rw-r--r-- 1 jroquet kmem 1521 2010-02-24 18:44
/udir/jroquet/Arkonf/screen/.screenrc
$ echo .screenrc(:A)
/udir/jroquet/Arkonf/screen/.screenrc

I'm running Ubuntu Linux 10.04, zsh 4.3.10

-- 
JÃrÃmie



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