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


Groups > gnu.bash.bug > #11585 > unrolled thread

Re: extglob syntax error in function definition

Started byEduardo A. Bustamante López <dualbus@gmail.com>
First post2015-10-07 22:44 -0500
Last post2015-10-07 22:44 -0500
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#11585 — Re: extglob syntax error in function definition

FromEduardo A. Bustamante López <dualbus@gmail.com>
Date2015-10-07 22:44 -0500
SubjectRe: extglob syntax error in function definition
Message-ID<mailman.0.1444275868.12154.bug-bash@gnu.org>
> 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/

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web