Re: bash, expressions, ???
On Sun, Jan 05, 2003 at 10:23:16PM +0200, Egor Tur wrote:
> Hi.
> Who can explain?
> ps ax | grep lpd
> 398 ? S 0:00 lpd Waiting
> 5593 pts/13 S 0:00 grep lpd
> ps ax | grep [l]pd
> 398 ? S 0:00 lpd Waiting
>
> What do [l]?
When you do 'ps ax | grep [l]pd', the grep process that would show up in
the ps output would be 'grep [l]pd' and that won't match 'lpd' which is
what the '[l]pd' is expanded to by the shell. '[]' is a bracket
expression that's part of regular expressions. It matches any one of the
enclosed list of characters.
--
Ron Golan
GPG key http://home.attbi.com/~rgolan/gpg.asc
Reply to: