Path: csiph.com!goblin3!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Greg Wooledge Newsgroups: gnu.bash.bug Subject: Re: x[ Date: Mon, 29 Jul 2019 13:14:12 -0400 Lines: 27 Approved: bug-bash@gnu.org Message-ID: References: <9EA25AF1-6D80-456A-81FA-6D908072E624@gmail.com> <20190729171412.GD1218@eeg.ccf.org> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: usenet.stanford.edu 1564420473 21507 209.51.188.17 (29 Jul 2019 17:14:33 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-bash@gnu.org Envelope-to: bug-bash@gnu.org Mail-Followup-To: bug-bash@gnu.org Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 139.137.100.1 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <20190729171412.GD1218@eeg.ccf.org> X-Mailman-Original-References: <9EA25AF1-6D80-456A-81FA-6D908072E624@gmail.com> Xref: csiph.com gnu.bash.bug:15263 On Mon, Jul 29, 2019 at 01:09:28PM -0400, Eli Schwartz wrote: > On 7/29/19 1:01 PM, Clint Hepner wrote: > > The ``[`` begins a valid shell pattern, so the parser continues to > > accept input until the closing ``]`` is found. Pathname expansion > > (apparently) does not apply to the first "argument" of the > > ``function`` command. > > The initial workaround discovered, was to use > > $ function _[ () { echo hello; }; <() _[ > hello > > The use of <() somehow suppresses the glitch in the same way that > quoting it does. If it were just glob expansion, then why should that be so? Or even simpler: wooledg:~$ echo x[ x[ wooledg:~$ x[ > The glitch doesn't occur when the x[ is an argument of a simple command. It only occurs when x[ is being parsed *as* the command. So, while I suspect "looking for a glob" is part of the answer, it's not the whole picture.