dimanche 2 avril 2017

grouping and simplifying multiple if conditions / bash

I have multiple If conditions to to run at the beginning of the script

if blah; then
echo "hop"
fi
if [ ! -f blah-blah ]; then
echo "hop-hop"
else
echo "hip-hop-hap"
fi
if [ $? -eq 0 ]; then
echo "hip-hop"
fi

each of this conditions are separate from each other, and I have them 7-8 so I'm thinking if there is some way to group them... I was thinking to use elif , but elif will stop checking conditions if one of them is truth any suggestion would be ppreciated

Aucun commentaire:

Enregistrer un commentaire