[X-Unix] Wildcard * in Pathnames

Jerry Krinock jerry at ieee.org
Wed May 11 20:08:33 PDT 2005


In the arguments of various commands, for example "find" and "rm", I would
often like to match any path containing a given word with a wildcard
expression like:

    *Fruit*

And I expect this to match _any_ pathname containing "Fruit", including:
    
    ~/Fruit/Apple/Seeds
    /Applications/Fruit/Lemon.app
    /Volumes/MyHD/Fruit

but it never works.  The problem seems to be that the path separator
character "/" is beyond the scope of the wildcard "*".  I can get the
desired result if I search a set of wildcard expressions, such as:

    /*/Fruit/*
    /*/*Fruit/*
    /Fruit/*/*/*/
    etc.
    etc.
    etc.

Does anyone know a more elegant solution than this kludge?

Thank you,

Jerry Krinock




More information about the X-Unix mailing list