Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11585

Re: extglob syntax error in function definition

From Eduardo A. Bustamante López <dualbus@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: extglob syntax error in function definition
Date 2015-10-07 22:44 -0500
Message-ID <mailman.0.1444275868.12154.bug-bash@gnu.org> (permalink)
References <20151006122732.3006A264E1A@mail.jonkmans.nl>

Show all headers | View raw


> 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/

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: extglob syntax error in function definition Eduardo A. Bustamante López <dualbus@gmail.com> - 2015-10-07 22:44 -0500

csiph-web