Date: Wed, 14 Feb 2001 09:15:58 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Alain Magloire 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: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Precedence: bulk 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.