Recherche caractere
Fermé
yohann190996
-
1 juin 2016 à 14:11
UnGnU Messages postés 1158 Date d'inscription lundi 2 mai 2016 Statut Contributeur Dernière intervention 22 décembre 2020 - 1 juin 2016 à 15:07
UnGnU Messages postés 1158 Date d'inscription lundi 2 mai 2016 Statut Contributeur Dernière intervention 22 décembre 2020 - 1 juin 2016 à 15:07
A voir également:
- Recherche caractere
- Caractère ascii - Guide
- Caractere speciaux - Guide
- Caractère spéciaux - Guide
- Caractère spéciaux mac clavier - Guide
- Recherche musique - Guide
1 réponse
UnGnU
Messages postés
1158
Date d'inscription
lundi 2 mai 2016
Statut
Contributeur
Dernière intervention
22 décembre 2020
157
1 juin 2016 à 15:07
1 juin 2016 à 15:07
Salut,
Une façon de faire avec bash3.2 et supérieur :
Une façon de faire avec bash3.2 et supérieur :
$ cat m_test.sh #! /bin/bash reg="^.[BIO]" while : do read -p "Entrez un nom : " nom [[ ${nom} =~ ${reg} ]] && echo "Le second caractère est soit un B, soit un I ou encore un O" done
$ ./m_test.sh
Entrez un nom : label
Entrez un nom : oBsede
Le second caractère est soit un B, soit un I ou encore un O
Entrez un nom : LILLA
Le second caractère est soit un B, soit un I ou encore un O
Entrez un nom : LiLLA
Entrez un nom : kOlanta
Le second caractère est soit un B, soit un I ou encore un O
Entrez un nom : kolanta
Entrez un nom : ^C