Operating System - HP-UX
1827857 Members
1477 Online
109969 Solutions
New Discussion

Re: How to get the logical linked file?

 
SOLVED
Go to solution
Enrico Venturi
Super Advisor

How to get the logical linked file?

Hello colleagues,
I want to get the name of the faile logically linked by another one, in an executable program; I don't want to use s "system ll"; are there any system call, any library to get this information?

Thanks
Enrico
2 REPLIES 2
James R. Ferguson
Acclaimed Contributor
Solution

Re: How to get the logical linked file?

Hi Enrico:

Have a look at 'readlink(2)'.

Consider:

# ls -l /tmp/f1 /var/tmp/f1

-rw-r----- 1 root sys 0 Nov 25 13:14 /tmp/f1
lrwxr-x--- 1 root sys 7 Nov 25 13:14 /var/tmp/f1 -> /tmp/f1

With perl:

# perl -le '$_=readlink($ARGV[0]);print if defined' /var/tmp/f1

...returns:

/tmp/f1

Regards!

...JRF...
Billa-User
Regular Advisor

Re: How to get the logical linked file?

great information. this is very helpful for me