This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
*.jsp only matches the jsp files in the current directory, of course. Remember that under UNIX, it's the shell that expands wildcards, not individual programs like grep. If you need to generate a list of files, then you can use any tool in the UNIX arsenal. "find" is the first one I generall reach for:
grep isBabyBornYet `find . -name '*.jsp'`
Note those backticks (`) around the find command; that executes the enclosed command, and inserts the result into the grep command line.
By the way if I gave a command and it is thinking, how do I know if it is working on it or is simply not returing and not doing anything?
While top would work, you should see results within a few seconds to a minute, depending on how busy your system is or if you have to search through a lot of files. I would narrow the search to make it run faster as well as eliminate alot of unneccesary searches ..
This can be run from anywhere on the system.
This will "find" only jsp(s) from the current directory.
This will start the search from root "/". This will take the longest to complete.
author and iconoclast
Be careful, there, cj. The wildcards inside double quotes will be expanded immediately, before the commands in backticks are executed. Therefore you'll be asking find to find files in various places whose names match the JSP files in the current directory only. Using single quotes as I did prevents the wildcards from being expanded until the find program gets them; they'll then be used as a glob pattern in every directory find searches, which is what you want.
Joined: Mar 19, 2002
The wildcards inside double quotes will be expanded immediately, before the commands in backticks are executed. Therefore you'll be asking find to find files in various places whose names match the JSP files in the current directory only.
I agree with most of what you said but I have to respectfully disagree with the above statement. When you issue a comand on the command line, special characters are seen by the shell, then by the program, therefore "unqouted metacharacters" are interpreted by the shell for filename expansion. In order to bypass the shell and pass the the special characters to find or grep, use quotes. Double quotes will suffice in most cases, but single qoutes are the safest bet.
In the examples I gave double qoutes are sufficient and also the use of double qoutes at least in my examples will not confine the search only in the current directory.