• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTask - grep
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTask - grep


  • Subject: Re: NSTask - grep
  • From: tlr <email@hidden>
  • Date: Tue, 10 Jul 2001 20:39:26 +0200

Le mardi 10 juillet 2001, ` 02:24, email@hidden a icrit :

I want to grep for a pattern in a directory, and it's sub-directories.
If I use a file name instead of the wildcard '*', then it will work.
When I try to use the wildcard, I get this message: "grep:
/Users/kglenn/*: No such file or directory". If I execute the same
command from Terminal, it works perfectly. I thought maybe I had to
escape the '*' at first, but that didn't work.

NSTask *myTask=[[NSTask alloc] init];

[myTask setLaunchPath:@"/usr/bin/grep"];
[myTask setArguments:[NSArray
arrayWithObjects:@"-r",@"somestring",@"/Users/kglenn/*",nil]];
[myTask launch];
[myTask release];



As a matter of fact, the "-r" argument means "recursive search" for grep, so if you just pass the directory:
[myTask setArguments:[NSArray
arrayWithObjects:@"-r",@"somestring",@"/Users/kglenn/",nil]];
then it should work, doesn't it?

Thomas Lachand-Robert
********************** email@hidden
The Commandant Project: http://lachand.free.fr/
<< Et le chemin est long du projet ` la chose. >> Molihre, Tartuffe.


  • Prev by Date: Re: How to draw a NSImage in a view
  • Next by Date: slow drawing custom NSViews
  • Previous by thread: Re: NSTask - grep
  • Next by thread: Missing CFSocket documentation?
  • Index(es):
    • Date
    • Thread