[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
globstar: **/foo*/ matches all directories, even ones not named foo*
From: |
Anders Kaseorg |
Subject: |
globstar: **/foo*/ matches all directories, even ones not named foo* |
Date: |
Sun, 13 Sep 2009 11:47:12 -0400 |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL
-DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -g -O2 -Wall
uname output: Linux balanced-tree 2.6.31-10-generic #32-Ubuntu SMP Thu Sep 10
23:29:56 UTC 2009 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 4.0
Patch Level: 33
Release Status: release
Description:
With the globstar option enabled, bash seems to misinterpret
other wildcard path components between a **/ and the last / as
matching any path, even if the path doesnât match the
wildcard.
Repeat-By:
$ shopt -s globstar
$ mkdir -p foo/{a,b} bar/{c,d,foo/{e,f}} baz/{g,h}
Find everything beginning with foo (works):
$ echo **/foo*
bar/foo foo
Find directories beginning with foo (doesnât work):
$ echo **/foo*/
bar/ bar/c/ bar/d/ bar/foo/ bar/foo/e/ bar/foo/f/ baz/ baz/g/
baz/h/ foo/ foo/a/ foo/b/
Find everything inside a directory beginning with foo (doesnât work):
$ echo **/foo*/*
bar bar/c bar/d bar/foo bar/foo/e bar/foo/f baz baz/g baz/h
foo foo/a foo/b
- globstar: **/foo*/ matches all directories, even ones not named foo*,
Anders Kaseorg <=