SCJP 1.4, SCWCD 5, SCBCD 5, OCPJWSD 5,SCEA-1, Started Assignment Part 2
My blog- http://rkydesigns.blogspot.com
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
SCJP 1.4, SCWCD 5, SCBCD 5, OCPJWSD 5,SCEA-1, Started Assignment Part 2
My blog- http://rkydesigns.blogspot.com
Andrew Monkhouse wrote:The reverse search does a search through your last used commands backwards, matching on the text you provide.
Say for instance your command history includes:
Andrew Monkhouse wrote:Note: the actual commands used here are irrelevant - they are just used for an example
"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- Antoine de Saint-Exupery
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- Antoine de Saint-Exupery
Anand Hariharan wrote:Methinks you may have the wrong idea of grep's exit status. It returns 0 if matches are found.
Anand Hariharan wrote:Check for the exit status for commands executed with a for loop is most likely not going to give you what you want.
Anand Hariharan wrote:GNU grep (not in POSIX) has a -L option that may do what you want. [NB: I am writing this from a M$ box, and I do not know this for certain.]
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Andrew Monkhouse wrote:
Anand Hariharan wrote:Methinks you may have the wrong idea of grep's exit status. It returns 0 if matches are found.
Correct - but what I wanted was to find the files that did not contain the specified string, in which case checking for an exit status of 1 is correct.
Andrew Monkhouse wrote:
Anand Hariharan wrote:Check for the exit status for commands executed with a for loop is most likely not going to give you what you want.
Can you please elaborate? The $? should contain the exit status of the most recently executed foreground command, so on each loop it should contain the exit status of the grep statement that has just been run, which I can then use to determine whether the current file is one I care about or not. Checking the exit status outside of the loop does not make sense - it would only tell me the exit status of the very last file checked.
Andrew Monkhouse wrote:
Anand Hariharan wrote:GNU grep (not in POSIX) has a -L option that may do what you want. [NB: I am writing this from a M$ box, and I do not know this for certain.]
Doh! I have spent far too many years on non-GNU based systems, so I tend to go with POSIX options. I am currently using a Macintosh, and I didn't think to check what version of grep I am using - it is GNU grep. So I could have used that.
Thanks!
"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- Antoine de Saint-Exupery