• 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: Jens Alfke <email@hidden>
  • Date: Tue, 18 May 2010 13:13:34 -0700

On May 18, 2010, at 12:33 PM, appledev wrote:

> I dont want to use a call to a bash script, because of sneaking in bad commands.

As others said, it’s not a problem here because the command line is entirely hardcoded.

If you wanted to avoid using a shell, you’d have to start three separate NSTasks for the three commands (df, grep, awk) and hook the output pipe of one to the input of the next. I’m not sure how to do that.

Of course, you could skip the grep and awk tasks and do the job yourself — looks like you’re just matching against a string, breaking the lines into pieces and then formatting the result. Probably three or four lines of Obj-C.

—Jens_______________________________________________

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

  • Follow-Ups:
    • Re: NSTask and piped commands
      • From: René v Amerongen <email@hidden>
    • Re: NSTask and piped commands
      • From: Alastair Houghton <email@hidden>
References: 
 >NSTask and piped commands (From: appledev <email@hidden>)

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