storing symbolic link target into a variable



Hello everyone!

Can someone let me know how to get target name of a symbolic link and
store it into a variable? For example

system( "readlink $link" );

only prints the target name. I would like to store the target name into
a variable, say $target, without printing it.

Ultimately I would like to have a procedure that copies a regular file
and one or more of its symbolic links, into another file and another
set of symbolic links pointing to the copy of the original file. In
other words a set of files should be copied so that their link
structure is preserved. Is there any high level function that can do
the job?

Regards,
Aurel.

.



Relevant Pages

  • Re: cant set group owner cdrom for link /dev/dvd
    ... Symbolic links are by design that way, ... permissions of the target are what matter. ... Hard links are just that. ... if you are using any kind of Debian Linux other than Woody ...
    (Debian-User)
  • Re: Creating Partition for virtual memory
    ... > Thanks for the clarification Francis. ... to the target location (new drive or folder), then empty the contents of the ... for a brief description of ntfs symbolic links and a tool for creating them, ...
    (microsoft.public.windowsxp.customize)
  • Re: [9fans] p9p vac/vacfs compatibility: uid/gid, ctime, 9P2000.L, 9pserve
    ... The symbolic links show up as links, but with the null string as ... At least concerning 9pfuse and symlink. ... 9pfuse read the symlink target from Dir.ext, ... other Unix special files don't seem to be currently ...
    (comp.os.plan9)
  • Re: makefile with "ln"
    ... John Small wrote: ... And 'ln TARGET' form is not supported on OS/2, ... determines that hard links do not work but symbolic links do. ...
    (comp.os.os2.programmer.porting)
  • Re: is tcl a reasonable alternative to unix shell scripts?
    ... table of equivalent commands, but have not found built-in equivalents to ... pathname target. ... The second form makes a copy inside targetDir of each ... When operating on symbolic links, ...
    (comp.lang.tcl)