Carl Lowenstein wrote:
> On 11/7/05, m ike <[EMAIL PROTECTED]> wrote:
> >
> > (which would list foo1.ps, foo2.ps, foo3.ps). The generalization
> > would be something like
> >
> > ls -1d foo.[html,css,js]
> >
> > to list foo.css, foo,js, and foo.html, but not foo.js~ or
> > foo.js-2005-10-23-01
> >
> > The way I know is
> >
> > shopt -s extglob
> > ls -1d foo.+(html|css|js)
>
> Isn't this just brace expansion, pioneered in csh but also present in
> bash and ksh.
>
> $ ls -1d foo.{html,css,js}
>
> Works for me. Alternatively:
>
> $ ls foo.* | grep -E '(css|html|js)$'
No. Brace expansion happens whether the files are there or not. This is
why you can do things like
% cp file{,.bak}
and have it work, even if file.bak does not exist. With the extglob
shell option, the +() will only expand if it matches any portion.
zsh bash
% setopt extendedglob $ shopt -s extglob
% echo foo* $ echo foo*
foo.html foo.html
% echo foo.(html|css|js) $ echo foo.+(html|css|js)
foo.html foo.html
% echo foo.{html,css,js} $ echo foo.{html,css,js}
foo.html foo.css foo.js foo.html foo.css foo.js
-john
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list