NSTask: Arguments with Ticks
NSTask: Arguments with Ticks
- Subject: NSTask: Arguments with Ticks
- From: Leif Singer <email@hidden>
- Date: Tue, 13 Feb 2007 19:38:11 +0100
Hello list,
I'm trying to use NSTask to execute several command line utilities,
stacked up behind each other through NSPipes. Basically, I'm trying
to put together this:
netstat -ibn -I en1 | grep -m 1 en1 | awk {'print $7'}
This works fine until I need to use the ticks (') for awk. This
problem isn't specific to awk, but also happens when using ticks in
other utilities. E.g., netstat -ibn -I 'en1' from the cli works just
as fine as without the ticks, but using NSTask this stops working.
awk returns a syntax error, grep and netstat return no results.
I also tried escaping the ticks, escaping the escaping, etc., to no
avail. I looked at the result of fileSystemRepresentation for an
NSString containing ticks, which left them perfectly fine.
Could someone give me a pointer on how to resolve this? I know awk
can load its program from a file as well, effectively circumventing
the use of ticks, but before resorting to something like that I'd
rather know how to resolve this in a general manner. I have no clue
what NSTask actually tries to execute, i.e., how exactly it assembles
launchPath, arguments, etc.
Thanks in advance
Leif Singer
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden