INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

how to findout root symlink directory?

how to findout root symlink directory?

(OP)
HI,

Thanks for looking at this.

I have a directory, which is a symlink

ex?ls -ld temp --> temporg2
ls -ld temporg2 --> temp_org

I would like to set temp_org to my final name based on temp.

Thanks in advance.

RE: how to findout root symlink directory?

use [file readlink name]

_________________
Bob Rashkin

RE: how to findout root symlink directory?

(OP)
Thanks Bond,

It is only giving one level.

if there are 2 levels of links or 3 levels of links, i want the one which is very origin.
ex:
a->b
b->c
c->d

set var [file readlink $input] giving b when i pass input as a.

RE: how to findout root symlink directory?

(OP)
if it is perl i can use below code

while (-l $input) {
$input = readlink($input)
}

then it will go till it doesn't find symlink.

But i am not sure how to do it in TCL.

please let me now if any of you have clues.

RE: how to findout root symlink directory?

Hi

Not much bigger theory neither in Tcl :

CODE --> Tcl

while {[file type $input]=="link"} {
set input [file readlink $input]
}

Feherke.
http://feherke.github.com/

RE: how to findout root symlink directory?

(OP)
Amazing, this is what I wanted.
thanks a ton Feherke.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close