On Wed, Mar 20, 2002 at 11:37:43AM +0000, John Tobin wrote:
> > What is it about grep and RE that causes this behaviour ? (note that the
> > above example is not always correct. For example,
>> The command line as shown by ps will be "grep [f]oo", which doesn't
> match "foo".
Doh!
> > niall at bagend:~ >ps -ax|grep [f]oo
> > 1944 pts/8 S 0:00 grep foo
> >
> > but if you ensure that grep sees the RE like this
> >
> > niall at bagend:~ >ps -ax|grep "[f]oo"
> > niall at bagend:~ >
> >
> > it's fine)
>> Do you by any chance have a file called foo in that directory? bash
Double doh! - I know bash expands [f] hence I quoted it for grep but making
the logical leap of looking for a local foo escaped me :-) - I do of course
have one.
> > Does grep manipulate its arguments as saved or what ? Because I called my
> > script ssh-agent-setup I matched on "$USER.*ssh-agent$" and that works also
> > (i.e. ps|grep doesn't find the grep) but leaving out the $ doesn't work
Yes, clearly the same answer as above.
Thanks,
Niall
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!