From owner-freebsd-questions Thu Nov 9 1:11: 7 2000 Delivered-To: freebsd-questions@freebsd.org Received: from isy.liu.se (isy.liu.se [130.236.48.10]) by hub.freebsd.org (Postfix) with ESMTP id 61B7437B479 for ; Thu, 9 Nov 2000 01:11:03 -0800 (PST) Received: from lagrange.isy.liu.se (lagrange.isy.liu.se [130.236.49.127]) by isy.liu.se (8.10.0/8.10.0) with ESMTP id eA99B1n11663 for ; Thu, 9 Nov 2000 10:11:01 +0100 (MET) Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit MIME-Version: 1.0 Date: Thu, 09 Nov 2000 10:11:01 +0100 (CET) From: Micke Josefsson To: freebsd-questions@freebsd.org Subject: A weird inconsistency: ls vs. cp Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG This is an inconsistency that has bugged for a long time. It seems to be the same on every system I have tried: BSD/Linux/Solaris. I have to live with it but I cannot for my life understand why it is there! There is a difference between a directory name with and without a slash - sometimes. An example. #pwd #/usr/home/mj/tmp #du 10 ./usr 20 ./usr/local # Now these two cp's do not do the same thing: #cp -r usr / (copies 'local' above to /usr/local) #cp -r usr/ / (copies 'local' above to /local) So there is a difference between usr and usr/, right? Appending a / means to contents of the directory? No! Not so when trying with ls: #ls -l usr total 1 drwxr-xr-x 2 root mj 512 9 Nov 10:00 local #ls -l usr/ total 1 drwxr-xr-x 2 root mj 512 9 Nov 10:00 local ls does not differentiate usr and usr/ while cp does. To get what I'd like to call 'ls -l usr' you have to do #ls -ld usr drwxr-xr-x 3 root mj 512 9 Nov 10:00 usr (or ls -ld usr/ of course) Why is this? I really like the subtle difference with the slash as in cp example above. While on the subject of strange behaviours, how about this to see all dot-files in my ~. #ls \.* I explicitly tell it to show only strings starting with a '.', but does it (or do I tell it to)? Oh, no. It lists every other file and directory as well. This latter is probably due to my misunderstanding of regexps, but still... Can anyone shed some light on this? I am very curious! Cheers, Micke ---------------------------------- Michael Josefsson, MSEE mj@isy.liu.se This message was sent by XFMail running on FreeBSD 3.5-STABLE ---------------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message