LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can I make symbolic link relative?? (https://www.linuxquestions.org/questions/linux-newbie-8/can-i-make-symbolic-link-relative-761996/)

sk1ds 10-15-2009 12:27 AM

Can I make symbolic link relative??
 
Hi all

Not quite sure how to explain this but I have a problem with creating a symbolic link that then has another symbolic link in the directory underneath that points back to a directory.

I'll try and show an example

$ ls -l /home/mydir

lrwxrwxrwx 3 user group 4096 Aug 27 2009 dog -> /d01/bart/dog
drwxr-xr-x 3 user group 4096 Aug 27 2009 bin
drwxr-xr-x 3 user group 4096 Aug 27 2008 top

$ cd /home/mydir/dog
$ ls -l

drwxr-xr-x 1 user group 33 Oct 15 15:31 yellow_dir

$ cd /yellow_dir
$ ls -l

lrwxrwxrwx 1 user group 33 Oct 15 15:31 cat -> ../../top/cat


Is there anyway to avoid using the full path to /home/mydir/top/cat ?
as if yellow_dir was actually a sub-directory of /home/mydir/dog?

The reason is that when I clone this environment, some of the directory paths have different environment names in (like DEV or TEST) and using
relative paths means I dont have to worry about re-naming?

Hope I have explained?

thanks

i92guboj 10-15-2009 12:38 AM

There's no problem in doing that, for example:

Code:

ln -s .. foodir


All times are GMT -5. The time now is 05:25 PM.