Re: [#!/fr] Lister des fichiers dont les noms ont des blancs

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Emmanuel Borlet
Date:  
À: La liste francophone des scripts shell
Sujet: Re: [#!/fr] Lister des fichiers dont les noms ont des blancs
le bash peut ajouter des éléments à la commande find avant de la lancer
cela depend du dossier ou en lace celle-ci et si la structure répond à des
fichiers present *<>

# echo test.*
test.vmdk
# echo test.\*
test.*
# ls -la
total 12
drwxr-xr-x 2 root root 4096 mai 14 11:56 .
drwxr-x--- 9 root root 4096 mai 14 12:11 ..
-rw-r--r-- 1 root root    0 mai 14 11:56 00001111.vmdk
-rw-r--r-- 1 root root    0 mai 14 11:56 0000.vmdk
-rw-r--r-- 1 root root    0 mai 14 11:55 test.vmdk
-rw-r--r-- 1 root root    0 mai 14 11:56 ti ti.vmdk


c'est a find de se débrouiller avec * il ne faut pas le poluer avec une
"expansion" bash

"      -name pattern
              Base of file name (the path with the leading directories
removed) matches shell pattern pattern.  The metacharacters (‘*’, ‘?’,  and
 ‘[]’)
              match  a  ‘.’  at  the  start of the base name (this is a
change in findutils-4.2.2; see section STANDARDS CONFORMANCE below).  To
ignore a
              directory and the files under it, use -prune; see an example
in the description of -wholename.  Braces are not recognised as being
special,
              despite the fact that some shells including Bash imbue braces
with a special meaning in shell patterns.  The filename matching is
performed
              with the use of the fnmatch(3) library function.   Don’t
forget to enclose the pattern in quotes in order to protect it from
 expansion  by
              the shell."


donc soit <patern>\* ou '<patern>*'
mais pas "<patern>*"


Le 14 mai 2012 14:02, Fabien COMBERNOUS <fcombernous@???> a écrit :

> On 14/05/2012 12:15, Emmanuel Borlet wrote:
>
>>
>> il faut absolument échapper les * dans find !!
>>
>
> Affirmation affirmative erronée.
> Le * (étoile) fait parti des méta-caractères possibles. C'est bien pour
> cela que ma proposition met des guillemets au pattern. :)
>
> cf man find.
>
>
>
> --
> *Fabien COMBERNOUS*
> /unix system engineer/
> www.kezia.com <http://www.kezia.com/>
> *Tel: +33(0)4 6787 0704 / +33(0)6 2584 0337*
> Kezia
> ______________________________**_________________
> archives :
> http://listes.patpro.net/list/**sshfr.fr.html<http://listes.patpro.net/list/sshfr.fr.html>
> http://listes.patpro.net/**mailman/listinfo/script_shell_**fr<http://listes.patpro.net/mailman/listinfo/script_shell_fr>
>

_______________________________________________
archives :
http://listes.patpro.net/list/sshfr.fr.html
http://listes.patpro.net/mailman/listinfo/script_shell_fr