do
if [ $i = "--no-mail" ]
then nomail=1;
+ fi;
+ if [ $i = "--numcbde" ]
+ then searchnumcbde=1;
fi
done
-# Si on n'a *pas* mis no-mail (too many negations, I know)
-if [ -z "$nomail" ]
+# Si on n'a *pas* mis --no-mail (too many negations, I know)
+if [ -z "${nomail}" ]
then
adding=" OR email ILIKE '%$1%'"
fi
+# Si on a mis --numcbde, il faut matcher numcbde de manière plus lâche
+if [ "${searchnumcbde}" = "1" ]
+then
+ wild="%"
+fi
psql bde -c "SELECT * FROM adherents WHERE pseudo ILIKE '%$1%' OR nom ILIKE '%$1%'
- OR prenom ILIKE '%$1%'$adding OR CAST(numcbde AS varchar)='$1' ORDER BY nom;"
+ OR prenom ILIKE '%$1%'${adding} OR CAST(numcbde AS varchar) LIKE '${wild}$1${wild}' ORDER BY nom;"