This is about filename globbing, right? First, for the parentheses to work, you need to have extended globbing turned on in the bash shell. This probably means that you have to turn it on in the script, if you are writing a script. This is the command: shopt -s extglob More info: http://www.linuxjournal.com/content/bash-extended-globbing I did this so that I could test some patterns: mkdir test cd test touch messages syslog anaconda.syslog messages.1 syslog.1 syslog.2.gz Using echo or ls does basically the same thing: echo !(*.)s*s*g!(*.*) ls !(*.)s*s*g!(*.*) echo !(*.)s*s*g!(*1|*z) ls !(*.)s*s*g!(*1|*z) I see the same thing that you see: $ ls !(*.)s*s*g!(*.*) messages syslog syslog.2.gz $ ls !(*.)s*s*g!(*1|*z) messages syslog I don't often use the !() syntax, so it's nice to be reminded of it. So !(*.)s*s*g!(*.*) matches syslog.2.gz like this: !(*.)s * s * g !(*.*) s y s log.2. g z So the g in the pattern is matching with the g in gz, not the g in log. It's hard to say what you are shooting for here. That is, what else do you want to match in addition to the two exact filenames? If I just wanted the two filenames, I might do this: {syslog,messages} Mike On Sat, 10 May 2014, gregrwm wrote: > ok you bashers, check me on this: > > matches wanted: messages syslog > matches not wanted: anaconda.syslog messages.1 syslog.1 syslog.2.gz > pattern1: !(*.)s*s*g!(*.*) > pattern1 match results: messages syslog syslog.2.gz syslog.3.gz syslog.4.gz > pattern2: !(*.)s*s*g!(*1|*z) > pattern2 match results: messages syslog > > so pattern2 works. but is that pattern1 result a bug? >