bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: grep.... I know I am new to ubuntu but....


From: John Cowan
Subject: Re: grep.... I know I am new to ubuntu but....
Date: Thu, 9 Feb 2012 01:54:17 -0500
User-agent: Mutt/1.5.18 (2008-05-17)

DAVE HITCHMAN scripsit:

> So the 'search in sub directories' flag doesn't work?

The -i flag is for case-insensitive search.  The "search in directories"
flag is -R (or -r, same thing), but it searches *all* files in those
directories, not only ones that match a particular wildcard pattern.  So

        grep -R 'mystring' .

will search all files in the current directory tree.

There is another approach using just 'grep', provided you are using the
GNU version (as both Linux and Cygwin do).  Typing 'grep --help' will
tell you what it is.

> Why does the shell try and fail to do the right thing? If it is going
> to 'process' one argument why does it not process them all?

It does process all arguments that contain ?, *, or [...], unless they are
protected by single quotes, as in the sample command lines I gave you.
In every case, such an argument is processed before the command is run.
Only a few commands such as ncftp do their own wildcard processing.

> I will have to grab myself a proper Unix build but I'm damned sure it
> worked there before, it certainly works in things like cygwin.

Your theory falls apart in the face of my facts.  All Unix-like systems
(Linux, *BSD, Solaris, Mac OS X, z/OS, Cygwin, and indeed plain Windows
when you are using a Posix-compatible shell like Msys or MKS) behave
exactly the same way in this respect.  This behavior has been in place
since at least 1971, when the original Thompson shell was written.

-- 
John Cowan                                address@hidden
I amar prestar aen, han mathon ne nen,    http://www.ccil.org/~cowan
han mathon ne chae, a han noston ne 'wilith.  --Galadriel, LOTR:FOTR



reply via email to

[Prev in Thread] Current Thread [Next in Thread]