Forum Programmation.shell Problème avec getopts ?

Posté par  . Licence CC By‑SA.
Étiquettes :
1
24
juil.
2016

Bonjour,

Je rencontre un comportement que je n’arrive pas à m’expliquer.

Le script est interprété par /bin/sh et utilise getopts. Lorsque je fais ceci :

$ ./check_files.sh -d /tmp -td -x*a*

Mon argument est bien repris (à la fin) :

+ find /tmp/geany_socket.9912fb56 /tmp/gpg-OBxSqk /tmp/log /tmp/ssh-bfbl8kSNDM8o /tmp/systemd-private-0a769fff0c124fed8a42ec56733ade46-systemd-timesyncd.service-09Wbx1 /tmp/. /tmp/.. /tmp/.ICE-unix /tmp/.Test-unix /tmp/.X0-lock /tmp/.X11-unix /tmp/.XIM-unix /tmp/.font-unix /tmp/.xfsm-ICE-BILXKY -prune -type d ! -name *a*

Seulement si je remplace le 'a' pour un 'i' :

$ ./check_files.sh -d /tmp -td -x*i*

j’obtiens ceci (…)