[GLLUG] Re: symbolic links
David Smith
smithd98 at msu.edu
Sun Mar 20 13:04:25 EST 2005
I don't understand this.
1) I was doing cd /mnt
2) Then I was doing ln -s /a
3) Then I would do rm a
I did this a number of times with no problems.
This morning those steps worked, but /mnt/a@ was in red.
I did cd a and got an error:
"too many levels of symbolic links"
I searched on google and found this site:
http://www.scit.wlv.ac.uk/cgi-bin/mansec?1B+ln
"When the last argument is a directory, simple basenames
should not be used for pathname arguments. If a basename is
used, the resulting symbolic link points to itself:
example% /usr/ucb/ln -s file /tmp
example% ls -l /tmp/file
lrwxrwxrwx 1 user 4 Jan 12 00:16 /tmp/file -> file
example% cat /tmp/file
/tmp/file: Too many levels of symbolic links
To avoid this problem, use full pathnames, or prepend a
reference to the PWD variable to files in the working direc-
tory:
example% rm /tmp/file
example% /usr/ucb/ln -s $PWD/file /tmp
lrwxrwxrwx 1 user 4 Jan 12 00:16 /tmp/file ->
/home/user/subdir/file"
So I did
1) cd /mnt
2) /bin/ln -s /a
3) cd /a
and it worked!
Then i did cd .. ; rm a ; ln -s /a
and it worked!
I can recreate the behavior explained on the manual page, but I did ln
-s /a ; rm about 30 times and now I can't recreate the problem I was
experiencing this morning...
Any ideas what happened?
More information about the linux-user
mailing list