Date: Mon, 11 Jan 1999 08:14:15 -0500 (EST) From: "Crist J. Clark" <cjc@cc942873-a.ewndsr1.nj.home.com> To: malartre@aei.ca (Malartre) Cc: root@aew.k2.dorm.ncku.edu.tw, newbies@FreeBSD.ORG Subject: Re: find a error in The FreeBSD User Guide (i guess) Message-ID: <199901111314.IAA25181@cc942873-a.ewndsr1.nj.home.com> In-Reply-To: <36979C7F.2C771900@aei.ca> from Malartre at "Jan 9, 99 01:14:24 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
Malartre wrote, > Charlie Root wrote: > > $ ln -s mydir/dir dir > > $ ls -l > > lrwxrwxrwx 1 elvis elvis 9 28 nov 18:56 dir -> mydir/dir > > > > because dir is a directory > > so it may changed as follows:? > > lrwxrwxrwx 1 elvis elvis 9 28 nov 18:56 dir -> mydir/dir(/)? > It is not an error, because if you do the command ls -l on a directory > where there is a symbolic link, you won't have that (/) at the end. > Try it > Thank You Nope, not true. A symbolic link will be just what you typed in. The original poster was not correct in that there was an error in the book, but the original poster's command would work too. % ln -s /mydir/dir check1 % ln -s /mydir/dir/ check2 % ls -l check* lrwxrwxrwx 1 cjc cjc 10 Jan 11 08:04 check1 -> /mydir/dir lrwxrwxrwx 1 cjc cjc 11 Jan 11 08:04 check2 -> /mydir/dir/ There is no checking or any change made to the first argument by the 'ln' command when doing symbolic linking. That's why you can point to directories that do not exist, % ln -s /non/sense/path check3 No error. This is often useful if you have links to files that sometimes do and sometimes don't exist, e.g. on a filesystem that is not always mounted. Note that the original issue whether to end a link to a directory with a '/' is mostly a moot point. If I were to refer to a file in 'check1' or 'check2,' each expands so, check1/file => /mydir/dir/file check2/file => /mydir/dir//file Which the system sees as the same file. It effectively ignores multiple slashes and treats them as one. -- Crist J. Clark cjclark@home.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-newbies" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901111314.IAA25181>