From: Salve =?ISO-8859-15?Q?H=E5kedal?= on 7 Jul 2010 13:49 This works well on the command line: for f in !(*jpg); do echo $f; done But in a script it gives this error message: ../script: line 1: syntax error near unexpected token `(' ../script: line 1: `for f in !(*jpg); do echo $f; done' Why? (I use GNU bash, version 3.2.39(1)-release) -- Salve
From: pk on 7 Jul 2010 13:37 On Wed, 7 Jul 2010 17:49:06 +0000 (UTC) salve(a)slogedalen.no (Salve Håkedal) wrote: > This works well on the command line: > > for f in !(*jpg); do echo $f; done > > But in a script it gives this error message: > ./script: line 1: syntax error near unexpected token `(' > ./script: line 1: `for f in !(*jpg); do echo $f; done' > > Why? > > (I use GNU bash, version 3.2.39(1)-release) Put shopt -s extglob at the beginning of the script.
From: Salve =?ISO-8859-15?Q?H=E5kedal?= on 7 Jul 2010 14:36 pk <pk(a)pk.invalid> wrote: > On Wed, 7 Jul 2010 17:49:06 +0000 (UTC) > salve(a)slogedalen.no (Salve H�kedal) wrote: > >> This works well on the command line: >> >> for f in !(*jpg); do echo $f; done >> >> But in a script it gives this error message: >> ./script: line 1: syntax error near unexpected token `(' >> ./script: line 1: `for f in !(*jpg); do echo $f; done' >> >> Why? >> >> (I use GNU bash, version 3.2.39(1)-release) > > Put > > shopt -s extglob > > at the beginning of the script. > THANK YOU! -- Salve
|
Pages: 1 Prev: awk passing variables Next: substitution for octal chars |