un ptit coup de find à la rescousse : tigrou@Lorien:~/tmp/shell$ for i in $(seq 1 15) ; do touch $i.png ; done
tigrou@Lorien:~/tmp/shell$ ls
10.png 12.png 14.png 1.png 3.png 5.png 7.png 9.png
11.png 13.png 15.png 2.png 4.png 6.png 8.png
tigrou@Lorien:~/tmp/shell$ rm `find . -name '*.png' -a -not -name 5.png -type f`
[^] # Re: quel shell exactement ? , les globings/wildcards ne sont pas des reg
Posté par Damien Pobel (site web personnel) . En réponse au message question con sur le shell. Évalué à 4.
tigrou@Lorien:~/tmp/shell$ for i in $(seq 1 15) ; do touch $i.png ; done
tigrou@Lorien:~/tmp/shell$ ls
10.png 12.png 14.png 1.png 3.png 5.png 7.png 9.png
11.png 13.png 15.png 2.png 4.png 6.png 8.png
tigrou@Lorien:~/tmp/shell$ rm `find . -name '*.png' -a -not -name 5.png -type f`
tigrou@Lorien:~/tmp/shell$ ls
5.png
https://damien.pobel.fr