bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

globstar question


From: L A Walsh
Subject: globstar question
Date: Fri, 28 Apr 2017 17:09:11 -0700
User-agent: Thunderbird


I wanted to search for a file that had 'Tokyo' in the basename,
in all directories below a given point.  I had been doing it 'find',
but thought globstar should work.
W/globstar set, I looked for:

ls **Tokyo*
(nothing)
ls ***Tokyo*
(nothing)
ls **Tokyo**Tokyo*
(nothing)
ls **/*Tokyo*
(found multiple matches (including the one I was
searching for))

A sample file I was searching for:

Library/Tokyo Ravens/[gg]_Tokyo_Ravens_-_01_[398DE7BC].mkv

I.e. had Tokyo in _both_, dir and subfiles,
Why didn't any of the 1st 3 patterns find anything?

It seemed that I needed a '/' in the pattern for it
to be processed as a globstar pattern...??

Is that supposed to be a requirement for globstar
to function?  From this (from bash manpage):

 *      Matches any string, including the null string.  When  the
        globstar  shell  option  is  enabled,  and * is used in a
        pathname expansion context, two adjacent  *s  used  as  a
        single  pattern  will  match  all  files and zero or more
        directories and subdirectories.  If followed by a /,  two
        adjacent  *s  will match only directories and subdirecto-
        ries.

The slashes don't seem to be required.

Other glob settings:

dotglob         on
extglob         on
failglob        off
globasciiranges on
globstar        on
nocaseglob      on
nullglob        off

 echo $BASH_VERSION
4.4.12(2)-release

Thanks,
-linda








reply via email to

[Prev in Thread] Current Thread [Next in Thread]