probleme avec un script aix débutant
bonjour,
J'ai un probleme avec un shell script :
Je veux affecter la variable correspondante d'un parametre (numerique) a 0 ou 1 tout dépendant si le chiffre se retrouve dans mes parametre :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
while [ $# -gt 0 ]; do
# chech for the -ftp flag option
print "dans le while" >>log_plp_extract.lst
print $1 >> log_plp_extract.lst
echo $1
if [[$1 -eq 2]]; then deux=0
elif [[$1 -eq 3]]; then troix=0
elif [[$1 -eq 4]]; then quatre=0
elif [[$1 -eq 5]]; then cinq=0
elif [[$1 -eq 6]]; then six=0
elif [[$1 -eq 7]]; then sept=0
elif [[$1 -eq 8]]; then huit=0
elif [[$1 -eq 9]]; then neuf=0
elif [[$1 == ALL]]; then
deux=0
troix=0
quatre=0
cinq=0
six=0
sept=0
huit=0
neuf=0
fi
shift
done |
donc si je passe en parametre 1 et 5, la variable un et la variable cinq aura 1 dedans...
mais ca marche pas :
il me donne ca comme output :
1
mrk_plp_process.ksh[37]: [[1: not found.
mrk_plp_process.ksh[38]: [[1: not found.
mrk_plp_process.ksh[39]: [[1: not found.
mrk_plp_process.ksh[40]: [[1: not found.
mrk_plp_process.ksh[41]: [[1: not found.
mrk_plp_process.ksh[42]: [[1: not found.
mrk_plp_process.ksh[43]: [[1: not found.
mrk_plp_process.ksh[44]: [[1: not found.
mrk_plp_process.ksh[45]: [[1: not found.
5
mrk_plp_process.ksh[37]: [[5: not found.
mrk_plp_process.ksh[38]: [[5: not found.
mrk_plp_process.ksh[39]: [[5: not found.
mrk_plp_process.ksh[40]: [[5: not found.
mrk_plp_process.ksh[41]: [[5: not found.
mrk_plp_process.ksh[42]: [[5: not found.
mrk_plp_process.ksh[43]: [[5: not found.
mrk_plp_process.ksh[44]: [[5: not found.
mrk_plp_process.ksh[45]: [[5: not found.
mrk_plp_process.ksh étant mon nom de script...
j'ai essayé plusieurs chose mais j'arrive pas à voir mon probleme...
merci