Path: utzoo!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: File Name Globbing Message-ID: <8907170737.AA04585@aurel.caltech.edu> Date: 17 Jul 89 07:37:29 GMT References: <8907160207.AA22322@comp.vuw.ac.nz> Sender: daemon@tut.cis.ohio-state.edu Reply-To: bfox@aurel.caltech.edu.date.sun, 16 Jul 89 14:05:56 +1200 From: Ray Nickson Distribution: gnu Organization: GNUs Not Usenet Lines: 37 All right, time for me to stick my neck out again. The patch at the end implements behaviour that is almost this; I despise csh's `No Match' whining so much that I refuse to make an empty glob an error. If this causes some scripts to hang reading stdin, then you bought it, you pay for it. This patch should be considered experimental; I don't intend to put it into the installed bash here. While I like the idea, I'm unhappy that I had to change the globbing semantics to such an extent to make this work comfortably; in particular, I've hacked gloobing so that the first word of a command is _never_ globbed. I can't think why anyone would want the first word globbed, but still... The reason I did this was that `[' is a perfectly valid (and oft-used) command; perhaps the best solution is to say that invalid (as opposed to empty) globbing characters should be left as is. Discussion? 1) Your patch closely matches mine, excepting two things. The first is the name of the variable; I used "allow_null_glob_expansion". The second is the excepting the first word of the command. I didn't do this, mostly because it didn't occur to me. But it brings up an interesting point. You asked when someone would use globbing characters in a command. The answer is: whenever they thought it would ease typing, just as in any other situation. Perhaps the name of the command to run in the current directory is "please_run_this_command". In that case, "ple*nd" will run that command, and will have saved the user much typing. 2) You say the reason that you didn't expand the first word is because you know of a command that contains a globbing character. Well, this is a much better argument for Bourne shell behaviour than any other I have thought of, since the first word of a command is not the only place you will see a globbing character. In the "if" command is another place. As the second word in an "eval" command is another place. Brian Fox