[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
shopt can't set extglob in a sub-shell?
From: |
Davide Baldini |
Subject: |
shopt can't set extglob in a sub-shell? |
Date: |
Sat, 25 Feb 2012 21:42:29 +0100 |
Configuration Information [Automatically generated, do not change]:
Machine: i486
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL
-DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -g -O2 -Wall
uname output: Linux debianBunker 2.6.26-2-686 #1 SMP Wed Sep 21 04:35:47 UTC
2011 i686 GNU/Linux
Machine Type: i486-pc-linux-gnu
Bash Version: 4.1
Patch Level: 5
Release Status: release
Description:
A 'test.sh` script file composed exclusively of the following text
fails execution:
#!/bin/bash
(
shopt -s extglob
echo !(x)
)
giving the output:
$ ./test.sh
./test.sh: line 4: syntax error near unexpected token `('
./test.sh: line 4: ` echo !(x)'
Moving the shopt line above the sub-shell parenthesis makes the script
work.
The debian man pages give no explanation.
Thank you.
Repeat-By:
--
Fix:
--
- shopt can't set extglob in a sub-shell?,
Davide Baldini <=