bug-bash
[Top][All Lists]
Advanced

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

Re: extglob features less useful since shell scripts turn them off


From: Chet Ramey
Subject: Re: extglob features less useful since shell scripts turn them off
Date: Tue, 06 Jan 2015 09:35:35 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.3.0

On 1/5/15 10:20 PM, Jim Thomas wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: i686
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' 
> -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
> -DHAVE_CONFIG_H   -I.  -I../bash-3.2p17si2 -I../bash-3.2p17si2/include 
> -I../bash-3.2p17si2/lib   -Os
> uname output: Linux aa 2.6.39.3-v11 #9 SMP PREEMPT Tue Dec 13 11:07:11 HST 
> 2011 i686 GNU/Linux
> Machine Type: i686-pc-linux-gnu
> 
> Bash Version: 3.2
> Patch Level: 17
> Release Status: release
> 
> Description:
>         My interactive environment contains some shell functions that are
>         cleaner making use of "extglob on" of the interactive shell.  But
>         as soon as any other shell script is run they cause, e.g.,
> 
>         aa ~ > bashbug
>         /bin/sh: pushdHelper: line 14: syntax error near unexpected token `('
>         /bin/sh: pushdHelper: line 14: ` +@([1-9])*([0-9]))'
>         /bin/sh: error importing function definition for `pushdHelper'
> 
>         because the script is running "extglob off" and trying to interpret
>         the functions already in the environment.
> 
> Repeat-By:
>       Put an extglob feature in a function in the environment and run
>         a shell script.

You can export SHELLOPTS; that's how that variable should be used.  It's
up to how bash orders the environment as to whether it will be read by
the time the imported functions need the extglob setting.  The variable is
mostly intended to be used by shell scripts.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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