[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Obtaining the destination of a symbolic link
- From: Nagaev Boris <bnagaev@...>
- Date: Wed, 22 Jun 2016 02:36:03 +0300
On Tue, Jun 21, 2016 at 1:23 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> The symbolic link yyy points to zzz.
>
> I want to get zzz given yyy. The follwing code does it if ypu have bash.
>
> print (io.popen"ls -l yyy":read():match"->%s*(.*)$")
>
> Is there a system-independent way? Tried lfs; failed.
>
luarocks install luaposix
require 'posix.unistd'.readlink('yyy')
--
Best regards,
Boris Nagaev