> bash -c 'shopt -s extglob; echo @(foo*|bar*)' I've just discovered that this works as expected:
bash -O extglob -c 'echo @(foo*|bar*)' However, the puzzle lingers on, since running this: bash -c 'shopt -s extglob; shopt extglob' results in: extglob on which indicates that the original command should have worked as expected, recognizing the extglob pattern. There's still a mystery to unveal here.