NSTask - grep
NSTask - grep
- Subject: NSTask - grep
- From: Kent Glenn <email@hidden>
- Date: Mon, 9 Jul 2001 15:00:46 -0700
I'm having some problems getting grep to work with NSTask. I've gotten
NSTask to work with some of the examples for "ls" on this list. I have
even gotten it to work partially with "grep".
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];
I know it's something stupid I'm doing. Thanks in advance for the help.
-----------------------------
Kent Glenn
"The best way to get a drink out of a Vogon is to stick your finger down
his throat..."
- Douglas Adams