<div dir="ltr">Try this "/var/log/{messages,syslog}.?"</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 16, 2014 at 10:08 AM, Mike Miller <span dir="ltr"><<a href="mailto:mbmiller+l@gmail.com" target="_blank">mbmiller+l@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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:<br>

<br>
shopt -s extglob<br>
<br>
More info:<br>
<br>
<a href="http://www.linuxjournal.com/content/bash-extended-globbing" target="_blank">http://www.linuxjournal.com/<u></u>content/bash-extended-globbing</a><br>
<br>
I did this so that I could test some patterns:<br>
<br>
mkdir test<br>
cd test<br>
touch messages syslog anaconda.syslog messages.1 syslog.1 syslog.2.gz<br>
<br>
Using echo or ls does basically the same thing:<br>
<br>
echo !(*.)s*s*g!(*.*)<br>
ls !(*.)s*s*g!(*.*)<br>
<br>
echo !(*.)s*s*g!(*1|*z)<br>
ls !(*.)s*s*g!(*1|*z)<br>
<br>
I see the same thing that you see:<br>
<br>
$ ls !(*.)s*s*g!(*.*)<br>
messages  syslog  syslog.2.gz<br>
<br>
$ ls !(*.)s*s*g!(*1|*z)<br>
messages  syslog<br>
<br>
I don't often use the !() syntax, so it's nice to be reminded of it.<br>
So  !(*.)s*s*g!(*.*) matches syslog.2.gz like this:<br>
<br>
  !(*.)s  *  s  *       g   !(*.*)<br>
       s  y  s  log.2.  g   z<br>
<br>
So the g in the pattern is matching with the g in gz, not the g in log.<br>
<br>
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:<br>
<br>
{syslog,messages}<br>
<br>
Mike<br>
<br>
<br>
On Sat, 10 May 2014, gregrwm wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
ok you bashers, check me on this:<br>
<br>
matches wanted:  messages syslog<br>
matches not wanted:  anaconda.syslog messages.1 syslog.1 syslog.2.gz<br>
pattern1:  !(*.)s*s*g!(*.*)<br>
pattern1 match results:  messages syslog syslog.2.gz syslog.3.gz syslog.4.gz<br>
pattern2:  !(*.)s*s*g!(*1|*z)<br>
pattern2 match results:  messages syslog<br>
<br>
so pattern2 works.  but is that pattern1 result a bug?<br>
<br>
</blockquote>
______________________________<u></u>_________________<br>
TCLUG Mailing List - Minneapolis/St. Paul, Minnesota<br>
<a href="mailto:tclug-list@mn-linux.org" target="_blank">tclug-list@mn-linux.org</a><br>
<a href="http://mailman.mn-linux.org/mailman/listinfo/tclug-list" target="_blank">http://mailman.mn-linux.org/<u></u>mailman/listinfo/tclug-list</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Ben Lutgens<br>Linux / Unix System Administrator<br><br>Three of your friends throw up after eating chicken salad.  Do you think:<br>"I should find more robust friends" or "we should check that refrigerator"?<br>
       -- Donald Becker, on vortex-bug, suspecting a network-wide problem<br>
</div>