On Sun, Jan 05, 2003 at 10:23:16PM +0200, Egor Tur wrote:
> 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]?

Firstly, you want to quote '[l]pd', like so, in case you ever find
yourself running it in a directory where there is a file called lpd.

Secondly, there is no difference between what's matched by the regular
expressions /lpd/ and /[l]pd/ (I'm using the slashes there in
sed/awk/perl style to distinguish them more clearly from strings); both
match the sequence of three characters 'l', 'p', and 'd'. (/[l]/ is a
character class containing only the character 'l'; see 'man 7 regex'.)

The only thing that /[l]pd/ does is ensure that the grep doesn't find
the running grep command itself among the list of running processes
output by 'ps ax'. The regular expression /[l]pd/ does not match the
character string '[l]pd'.

-- 
Colin Watson                                  [[EMAIL PROTECTED]]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to