bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: extglob syntax error in function definition


From: Eduardo A . Bustamante López
Subject: Re: extglob syntax error in function definition
Date: Wed, 7 Oct 2015 22:44:20 -0500
User-agent: Mutt/1.5.23 (2014-03-12)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]