bug-bash
[Top][All Lists]
Advanced

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

extglob shell option does not propagate to child shells


From: Timo Ruiter
Subject: extglob shell option does not propagate to child shells
Date: Thu, 29 Aug 2002 12:32:00 +0200

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' -DSHELL -DHAVE_CONFIG_
H  -I.  -I. -I./include -I./lib -D_GNU_SOURCE  -O2 -march=i386 -mcpu=i686
uname output: Linux peter.ensdu.nl 2.4.18-11 #1 Thu Aug 15 07:24:20 EDT 2002
i686 unknown unknown GNU/Linux
Machine Type: i686-pc-linux-gnu

Bash Version: 2.05b
Patch Level: 0
Release Status: release

Description:
        Take two shell scripts:

        xx:
                shopt -s extglob
                function check_name
                {
                        [[ "$1" = !(aap|noot|mies) ]] && exit 13
                        echo OK
                }
                typeset -fx check_name
                ./yy "$1"

        and

        yy:
                check_name "$1"

        and then executing:

                ./xx

        When calling ./yy from ./xx the shell that is to execute the code of yy
complains:
                bash: check_name: line 1: syntax error in conditional 
expression:
unexpected token `('
                bash: check_name: line 1: syntax error near `!(a'
                bash: check_name: line 1: `check_name () {  [[ "$1" = 
!(aap|noot|mies) ]]
&& exit 13;'
                bash: error importing function definition for `check_name'
                ./yy: line 1: check_name: command not found
        In other words:  the extglob shell option is not active when importing
exported shell functions.
        This syntax error occurs prior to any statement in ./yy, so adding
'shopt -s extglob' as the first
        line in ./yy has no effect.
Repeat-By:
        1

Fix:
        Remove extglob shell option and make it active permanently (like the
posix-shell of HP-UX).





reply via email to

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