Bonjour,
Dans un script Bash je voudrais tester X Variables :
1- Si la variable existe
2- Si la variable à une valeur d’attribué
Pour voir si la variable est vide j’utilise
if [ -z ${mavar1} ] ; then
echo ${mavar} is empty
fi
Je n’arrive pas à obtenir le même résultat dans une boucle de test du style
tab_variable=(mavar1 mavar2 mavarX)
for i in ${tab_variable{*]}
do
if [ -z ${i} ] ; then
echo ${i} is empty
fi
done
Avez-vous une idée