🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #316

Bug/Feature in globbing

#316
From: Brian Fox
Date: Fri, 14 Jul 1989 13:11
41 lines
2074 bytes
   Date: 13 Jul 89 22:37:32 GMT
   From: tektronix!tekcrl!tekfdi!videovax!bart@cis.ohio-state.edu  (Bart Massey)
   Organization: Tektronix TV Measurement Systems, Beaverton OR
   References: <1897@prune.bbn.com>, <8907121835.AA02530@aurel.caltech.edu>
   Sender: bug-bash-request@prep.ai.mit.edu

   In article <8907121835.AA02530@aurel.caltech.edu> bfox@aurel.caltech.edu writes:
   > In csh, without `nonomatch' set, (note this could mean typing "unset
   > nonomatch"!), then
   > 	echo z*
   > 	  -> echo: no match
   > but
   > 	echo v* z*
   > 	  -> very virus
   > This is ambiguous behaviour in my opinion.

   Agreed.  But one of the biggest traps for beginners in Bourne Shell
   programming is exemplified by the fact that you can't write
	   for i in *
	   do
		   cat $i
	   done
   safely unless you're sure that there are files in the current directory.
   IMHO, what's wanted is
	   set nullglobok
   which inhibits both "no match" errors (which are almost never what I want
   in shell scripts anyway) and the funny behaviour of nonmatching patterns.

You mean "nullglobok=", not "set nullglobok".

   If "bash" (instead of "sh" (i.e. BASH emulating the Bourne Shell)) is
   started non-interactively, then I would probably choose "nullglobok" to be
   set by default.  But this is more a matter of taste.

I'm really amazed that you would want this behaviour. In the above `for'
command, with "nullglobok" non-null, and no files in the current
directory, the `cat' would hang, waiting for input, since `$i' would
expand to nothing.

Brian Fox
Technical Details
Message-ID: <8907141311.AA07040@aurel.caltech.edu>
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!AUREL.CALTECH.EDU!bfox
References: <5476@videovax.tv.Tek.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!AUREL.CALTECH.EDU!bfox
From: bfox@AUREL.CALTECH.EDU (Brian Fox)
Newsgroups: gnu.bash.bug
Subject: Bug/Feature in globbing
Message-ID: <8907141311.AA07040@aurel.caltech.edu>
Date: 14 Jul 89 13:11:37 GMT
References: <5476@videovax.tv.Tek.com>
Sender: daemon@tut.cis.ohio-state.edu
Reply-To: bfox@aurel.caltech.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 41