www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/02/14/02:18:21

Date: Wed, 14 Feb 2001 09:15:58 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Alain Magloire <alain AT qnx DOT com>
cc: djgpp-workers AT delorie DOT com
Subject: Re: [alain AT qnx DOT com: GNU_grep-2.5b_beta]
In-Reply-To: <200102140458.XAA21123@qnx.com>
Message-ID: <Pine.SUN.3.91.1010214091522.9705H@is>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Tue, 13 Feb 2001, Alain Magloire wrote:

> > >  [if test -d ".\."; then
> > Are you sure this test works?
> 
> Well if it did not work on DOS, Juan(?) could not have spotted the error.
> 
> >Wouldn't that resolve to 'test -d ..' on any system?
> 
> No, it will resolve to searching in the current directory "."
> for a directory call ".". Which can not be in Unix, "." and ".."
> always exist.
> 
> hmm, I probably confuse you even more ... see it this way
> if you were looking for Unix file system as oppose to DOS file system
> you would have test for this:
> 	if test -d "./."; then
> 	# Unix file
> 
> Better ?

No, because this test, when run on DOS, will tell you it's Unix ;-).

This is one of those, admittedly few, cases where DOS is ``smarter''
than Unix (for some value of ``smart'').  DOS normalizes all file
names before passing them to the actual system call code.  In
addition, DOS recognizes '/' as a valid directory separator in a file
name, together with '\'.  The upshot of all this is that "./."  gets
normalized to ".", and the test works.

> In any case credits go to Paul Eggert and Eli for this coocoo test ;-)

You are welcome.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019