Open Terminal with Swift

0

How can I ask for my graphic program to open a terminal window by passing a parameterized command? I'm using Swift for OS X, grateful.

    
asked by anonymous 17.03.2015 / 20:09

1 answer

0

To open any application you can use the open . The -b argument allows you to identify the application through your package, so to open the terminal you can do this:

open -b com.apple.terminal

Now, if you want to run some script after that, I believe (and maybe it's the best option) you'll need to create an executable file and then include it in the above command. For example, if you have a script.sh file, it looks like this:

open -b com.apple.terminal script.sh

Remembering that this file must have the necessary permissions to execute.

    
19.03.2015 / 17:34