linux - syntax error, unexpected token ... what's causing this? -


i'm using ssh secure shell connect linux machine ... when try run script, keep getting these errors ...

[grt@vm]mode  : d date  : 200806 bash: line 94: syntax error in conditional expression: unexpected token `(' bash: line 94: syntax error near `+([' bash: line 94: `        if [ ${#date} -ne 6 ] || [[ "$date" != +([0-9]) ]] ' 

my command:

ssh grt@$10.*.*.*  'bash -s' < purge.sh $1 $2 

the few lines of code have error...:

date="$2" if [ ${#date} -ne 6 ] || [[ "$date" != +([0-9]) ]]           echo "erreur  : $2 - format date incorrect"         echo "usage   : aaaamm - date composée de 6 chiffres (4 pour l'année et 2 pour le mois)"         echo "exemple : $0 d 200806"         exit 3 fi 

bash: line 118: syntax error in conditional expression: unexpected token `(' bash: line 118: syntax error near `+([' bash: line 118: `       if [[ "$nbmois" != +([0-9]) ]] || [ "$nbmois" -lt 0 ] || [ "$nbmois" -gt 99 ]' 

the few lines of code have error...:

nbmois="$2" if [[ "$nbmois" != +([0-9]) ]] || [ "$nbmois" -lt 0 ] || [ "$nbmois" -gt 99 ]     echo "erreur  : $2 - nombre de mois incorrect"     echo "usage   : entier numérique compris entre 0 et 99"     echo "exemple : $0 n 14"     exit 3 fi 

the remote machine has older version of bash. have enable extended patterns prepending following line script:

shopt -s extglob 

Comments