[bash]: strano problema con case
sto scrivendo uno script in bash, ed ho trovato uno stranissimo comportamento
(bug??):
$ echo $SHELL
/bin/bash
$ x=21; case $x in +([0-9])) echo "x is an integer";; esac
x is an integer
$ echo "x=21; case $x in +([0-9])) echo "x is an integer";; esac" >> test.sh
$ /bin/bash test.sh
test.sh: line 1: syntax error near unexpected token `('
test.sh: line 1: `x=21; case 21 in +([0-9])) echo x is an integer;; esac'
$
per favorire la lettura ecco l'esempio sopra ben indentato:
x=21;
case $x in
+([0-9]))
echo "x is an integer"
;;
esac
cosa c'è che non va? Perché nell'interprete funziona, ma non in uno script??
grazie
Reply to: