2

Here is a transcript of commands (and their output) that explains my problem:

/tmp/example $ shopt -s
cdspell         on
checkwinsize    on
cmdhist         on
complete_fullquote      on
direxpand       on
dirspell        on
expand_aliases  on
extglob         on
extquote        on
failglob        on
force_fignore   on
globstar        on
histappend      on
interactive_comments    on
login_shell     on
nocaseglob      on
nullglob        on
progcomp        on
promptvars      on
sourcepath      on

/tmp/example $ ls -R
.:
prefix_bar  prefix_foo

./prefix_bar:
test.c

./prefix_foo:
baz  test.c

./prefix_foo/baz:
test.c

/tmp/example $ ls prefix_@(foo/baz|bar)/test.c
prefix_bar/test.c

/tmp/example $ ls @(prefix_foo/baz|prefix_bar)/test.c
prefix_bar/test.c

Question: Why does bash ignore the foo/baz or the pattern_foo/baz portion of the pattern-list?

For the record, I looked around before posting this question and the question closest to what I am about to ask is bash extglob: Should the order of patterns in a pattern list matter? (and it does not answer my question).

2
  • 3
    This reply to a different question might help: unix.stackexchange.com/a/678859/58056 Commented Oct 7, 2023 at 0:37
  • 1
    Yes, it does, thank you @pfnuesel! I used to follow Stéphane Chazelas in comp.unix.shell a lot; he is awesome! Commented Oct 7, 2023 at 15:05

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.