bug-bash
[Top][All Lists]
Advanced

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

Weird shopt behavior


From: Petr Skočík
Subject: Weird shopt behavior
Date: Thu, 21 Jan 2016 01:07:01 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H   -I.  -I../. -I.././include -I.././lib 
-D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4
-Wformat -Werror=format-security -Wall
uname output: Linux laptop 3.19.0-32-generic #37~14.04.1-Ubuntu SMP Thu
Oct 22 09:41:40 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 4.3
Patch Level: 11
Release Status: release

Description:
  Not sure if this is a bug (it does bug me a little), however:

  main(){
    shopt -s extglob
    local line='     x bar'
    echo "${line##*( )}"
    case "$line" in
      *( )x*) ;;
      *) ;;
    esac
  }
  main "$@"

   fails with a syntax error on the first parenthesis in the case
statement. It does turn extglob on
  in other contexts (the echo line), but the extglob in the case
statement fails.
Interestingly, moving `shopt -s extglob` outside of main fixes the problem.





reply via email to

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