[H-GEN] Samba on SuSE 8.1
Jason Parker-Burlingham
jasonp at uq.net.au
Fri May 9 23:34:41 EDT 2003
[ Humbug *General* list - semi-serious discussions about Humbug and ]
[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]
Tony Nugent <tony at linuxworks.com.au> writes:
> On Thu May 08 2003 at 09:43, "Michael Anthon" wrote:
>> From: "Jason Parker-Burlingham" <jasonp at uq.net.au>
>> > The [s] in "[s]amba" means "match any of the characters `s'". If we
>> Ooooh, nice one, much better than my usual solution (when I care to remove
>> it) of using
>> ps auxww | grep processname | grep -v grep
> In fact, you can refine that even further...
> ps auxww | grep processnam\[e\]
> The "\[" and "\]" characters change the grep'ed string to glob only
> matches on the regular expression - which doen't include the grep
> command itself. (You can use this on any single character within
> the process name). Neat trick, try it.
That would be the same trick as I posted, but with one of its little
niggles removed. What you're doing when you quote the square brackets
is quoting them *from the shell*. You can see this by running
$ grep \[f\]oo
and moving to another terminal and grepping for grep processes:
$ ps ax | grep [g]rep
30638 pts/2 S 0:00 grep [f]oo
So you can see that grep gets a bracketed regular expression. The way
I do it does too, with one caveat: Unless you quote the brackets from
the shell, it will try to glob files in the current directory; if it
finds one the shell will replace your `[f]oo' with `foo'. This is why
at least in theory it'd be good to quote the brackets. In practice it
hardly ever matches and grep gets the argument without further
stuffing about.
>> /me adds that one to his list of tricks
> /you can add this one too :)
It's the same trick. You might find it easier to type
grep '[p]attern'
jason
--
``Oooh! A gingerbread house! Hansel and Gretel are set for life!''
--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'. See http://www.humbug.org.au/
More information about the General
mailing list