Re: NSTask - grep
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.