Path: csiph.com!au2pb.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.glorb.com!usenet.stanford.edu!not-for-mail From: Eduardo =?utf-8?Q?A=2E_Bustamante_L=C3=B3pez?= Newsgroups: gnu.bash.bug Subject: Re: extglob syntax error in function definition Date: Wed, 7 Oct 2015 22:44:20 -0500 Lines: 21 Approved: bug-bash@gnu.org Message-ID: References: <20151006122732.3006A264E1A@mail.jonkmans.nl> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: usenet.stanford.edu 1444275869 27039 208.118.235.17 (8 Oct 2015 03:44:29 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org, bash@packages.debian.org To: bashbug@jonkmans.nl Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=7PbBdVX1saIh4BoEunIk+WpfSJV+FgKgeMVJNswz0h0=; b=Q+887vhKNj8XzulMD966tmoH3WqpJS6DibpK7BQfUxPtpIu1wqYdn7wBOzap9vl2dl Xrx2BrkQgpvcCzY8EsDDTIkKfT4tXRJLaQWB1bwmHpAvMQuepOAy/MTd3gCJS00Iknhp Rlb77Wutx0TXgvoOHV2j38GrPPoAc/BKmx7m3j2fwf20Q8RgpVi+t8ByuglHkw1t4FjO C60AQs9tINFQJhZZAiQja+YQ8XsVwO/Dqu/YexwvHW1pZ6ClORP7D8CbKX/B6jl5J1bR M25UXigLAWA/op4Jj2Cb0Q76ApcYn90/UxmHe3W/tkcSJbxsIAXO0x+TVUwLSUIvXW4b thsw== X-Received: by 10.66.102.38 with SMTP id fl6mr5403215pab.36.1444275862083; Wed, 07 Oct 2015 20:44:22 -0700 (PDT) Mail-Followup-To: bashbug@jonkmans.nl, bug-bash@gnu.org, bash@packages.debian.org Content-Disposition: inline In-Reply-To: <20151006122732.3006A264E1A@mail.jonkmans.nl> User-Agent: Mutt/1.5.23 (2014-03-12) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::230 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:11585 > Repeat-By: > shopt -u extglob > isnum () ( shopt -s extglob; case "$1" in [1-9]*([0-9])) return 0 ;; *) return 1 ;; esac; ) Remember that bash parses and interprets the script line-by-line. If you want to change the parser's operation (for example, have it recognize the extglob patterns), you have to do it in a different line than where you're using the special syntax. If you have: shopt -s extglob; ls @(foo|bar) in the same line, it first processes the complete line, and fails at the extglob, before getting to execute the shopt command. This is not a bug btw, it's just a consequence of how bash works. -- Eduardo Bustamante https://dualbus.me/