Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!ginosko!gem.mps.ohio-state.edu!apple!bbn!news From: news@bbn.COM (News system owner ID) Newsgroups: comp.unix.wizards Subject: Re: ls Message-ID: <46913@bbn.COM> Date: 13 Oct 89 20:45:17 GMT References: <21100@adm.BRL.MIL> Reply-To: pplacewa@capella.bbn.com (Paul W. Placeway) Organization: Bolt Beranek and Newman Inc., Cambridge MA Lines: 38 In article <21100@adm.BRL.MIL> bush%ecs.oxford.ac.uk@nsfnet-relay.ac.uk (Mark Bush) writes: < grep 'pattern' .[^.]* * < < will probably match `.'! If the shell is _correctly_ handling the [^LETTERS] regexp (which Sys V shell thinks is [!LETTERS], but grep knows the truth), then neither . nor .. will be matched. Remeber: [ABC] means match one of 'A', 'B', or 'C'. This is _non-optional_; there must be a letter there. < .[\ -,\/-~]* < < does work in bash but seems to want to include both `.' and `..' in csh!!!! < Of course this pattern precludes files starting `.-' as well but who cares? Neat; a bug. Tcsh gets this wrong too, in case anyone is wondering; I'll have to fix that. It _should_ work in everything. I think it's caused by a quoting-bit (8th bit inside csh -- don't ask) problem, with the \/ (backquoted forward-quote). Try this: capella quant_test 332 -> echo 'foo is bar' > '.-' capella quant_test 333 -> echo .[\ --/-~]* .- capella quant_test 334 -> Note that you don't have to quote the second -; it's only magic when _between_ letters. < The inconsistancies here are more far reaching that it seems at first. < Perhaps shells should be written so that `.*' precludes `.' and `..'? Nope; not at all. Ever. If the user can't get the regexp right, that's not the fault of the shell, and the shell shouldn't be made to work _wrong_. -- Paul Placeway