• 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: Executing A Shell Script...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Executing A Shell Script...


  • Subject: Re: Executing A Shell Script...
  • From: Ondra Cada <email@hidden>
  • Date: Fri, 30 Aug 2002 19:01:54 +0200

On Friday, August 30, 2002, at 03:50 , Albert Atkinson wrote:

Thanks for your assistance! I have one more question about this...how would I display the result of the script in an NSTextView? Like if I typed "ls /MY/PATH" in the Terminal, it would print out all the contents of the path. How would I take what it prints out and display it in my NSTextView? Would it just be something like:

[NSTextView setText: system("ls My/Path")];

Don't use system; use NSTask. See its standard output option, NSPipe, and NSFileHandle.

If you for any reason wanna stick with the BSD API, "man popen", but NSTask's infinitely better and more convenient.

I was wondering if there was any way to execute a shell script from
Cocoa? I know in AppleScript you can do:

do shell script ("cd PATH/TO/FOLDER")

Since "cd" is a shell builtin, I really doubt this might work in any reasonable way.
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >Re: Executing A Shell Script... (From: Albert Atkinson <email@hidden>)

  • Prev by Date: Re: Executing A Shell Script...
  • Next by Date: Open an URL contained in an NSString
  • Previous by thread: Re: Executing A Shell Script...
  • Next by thread: Re: Executing A Shell Script...
  • Index(es):
    • Date
    • Thread