Add IfElifElse.sh
This commit is contained in:
1 parent
7cbbc9dda9
commit
26bf4b3be9
1 file changed
+19
@@ -0,0 +1,19 @@
|
|||||||
|
# Conditions sur saisie
|
||||||
|
echo "Entrez un code postal : \c"
|
||||||
|
read cp
|
||||||
|
if [[ $cp = 75[0-9][0-9][0-9] ]]
|
||||||
|
then
|
||||||
|
echo "$cp est un code postal parisien"
|
||||||
|
elif [[ $cp = @(7[78]|9[1-5])[0-9][0-9][0-9] ]]
|
||||||
|
# @ : Au moins le code département doit etre présent (2 chiffres)
|
||||||
|
then
|
||||||
|
echo "$cp est un code postal de la région parisienne"
|
||||||
|
elif [[ $cp = @([0-9][0-9][0-9][0-9][0-9]) ]]
|
||||||
|
# @ : Code postal obligatoire sur 5 chiffres
|
||||||
|
then
|
||||||
|
echo "$cp est un code postal de province (Métropole)"
|
||||||
|
else
|
||||||
|
echo "$cp n'est pas un code postal de France Métropolitaine"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
Reference in new issue
Block a user