• 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 and piped commands
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTask and piped commands


  • Subject: Re: NSTask and piped commands
  • From: "Stephen J. Butler" <email@hidden>
  • Date: Tue, 18 May 2010 14:52:24 -0500

On Tue, May 18, 2010 at 2:37 PM, Rick Genter <email@hidden> wrote:
> On May 18, 2010, at 12:33 PM, appledev wrote:
>
>>    NSArray *arguments;
>>    arguments = [NSArray arrayWithObjects: @"-c", @"/bin/df -k| /usr/bin/grep /dev/ | /usr/bin/awk '{print $1 $4 $5 $6;}'",nil];
>>       // arguments = [NSArray arrayWithObjects: @"-c", @"/bin/df -k", @"| /usr/bin/grep /dev/ | /usr/bin/awk '{print $1 '\t' $4 '\t' $5 '\t' $6;}'",nil];
>
> You have to pass each word as a separate string:
>
> arrayWithObjects: @"-c", @"/bin/df", @"-k", @"|", @"/usr/bin/grep", etc.

Normally you'd be correct, but in this case he would need to pass the
whole thing as a single argument to the '-c' flag of sh (you'd quote
it if you were actually in the shell).
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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

References: 
 >NSTask and piped commands (From: appledev <email@hidden>)
 >Re: NSTask and piped commands (From: Rick Genter <email@hidden>)

  • Prev by Date: Re: NSTask and piped commands
  • Next by Date: Re: Why I can't see my localized nib?
  • Previous by thread: Re: NSTask and piped commands
  • Next by thread: Re: NSTask and piped commands
  • Index(es):
    • Date
    • Thread