• 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: Hasan Diwan <email@hidden>
  • Date: Fri, 30 Aug 2002 09:38:55 -0400

While the provided method will work, mkdir may be called directly:
#import <errno.h>
#import <string.h>
#import <sys/types.h>
#import <sys/stat.h>
#import <Cocoa/Cocoa.h>
Bool makeFolder:(char *)folderName {
if ((mkdir (folderName, 0755)) != 0) {
NSLog(strerror(errno));
return NO;
}
return YES;
}
One may also use NSTask.
On 8/30/02 9:32 AM, "Rhon Fitzwater" <email@hidden> wrote:

> I think you should just be able to use: system(). So if you wanted to
> do, say mkdir, all you have to do is
> system("/bin/mkdir /DirMade");
> I added /bin to it because you may sometime get a zsh error, which
> means it cant find the command, so I always put in the full path to be
> safe. Hope this helps.
>
> -Rhon
> On Friday, August 30, 2002, at 09:13 AM, Albert Atkinson wrote:
>
>> Greetings!
>>
>> 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")
>>
>> And it will execute that script without launching the Terminal or
>> anything like that. Is there a method in Cocoa for doing this? Like:
>>
>> [MyShellScript do: @"cd PATH/TO/FOLDER"];
>>
>> ??? Thanks for your help in advance!
>>
>> Albert
>> _______________________________________________
>> 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.
> _______________________________________________
> 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.
>

--
Hasan Diwan
OpenPGP KeyID: BE42DCA6
OpenPGP Fingerprint: 1CB0 47E3 0A24 DAC1 DCCA 4225 F166 40C2 BE42 DCA6
_______________________________________________
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: Rhon Fitzwater <email@hidden>)

  • Prev by Date: Re: Executing A Shell Script...
  • Next by Date: Re: Executing A Shell Script...
  • Previous by thread: Re: Executing A Shell Script...
  • Next by thread: Re: Executing A Shell Script...
  • Index(es):
    • Date
    • Thread