sym link problem

Hi,
I am using Mac X 10.5. It's supporting BSD. I am getting strange problem.

� Launch the terminal.
� Create a directory. Use cd <directory>
� Now create another directory test with command �mkdir test�.
� Create a soft link with command �ln -s text.txt test�
� Go to the test directory �cd test�.
� Run the command ls -la. Output would be as

lrwxr-xr-x 1 root wheel 8 Sep 24 12:59 text.txt -> text.txt

Here, a file is pointing it self.
Anybody know, why it's happening.

Symlinks are actually very simple pointer files. It's quite easy to end up with links pointing at missing files or the wrong files by creating them incorrectly.

In your case, you asked for a link called "text.txt" (because you only specified a directory as the second arguement) pointing to "text.txt" and to place it in the 'test' directory.
It did what you asked :slight_smile:

If you want a relative symlink pointing to text.txt in the test directory, you need to create it from within the target dir. Otherwise, you can use an absolute link instead:

ln -s `pwd`/text.txt test