# Script or program to auto open/close terminals?



## max21 (Oct 28, 2017)

How would I write and execute a script that will open another terminal(s) and close itself afterwards?

How would I write and execute a script that will close other opened terminal(s), then close itself afterwards?

Apple use this osascript, and it is said that it can work with /bin/sh but I can’t figure out how to do it.

If anyone know how to do any of this or even come close, could you post an example no matter what programming language it is written in?

Here are the links that gave me a better clue while most others are asking the same questions as mys.


*Stackoverflow here:
https://stackoverflow.com/questions...a+terminal+using+a+script&gbv=1&hl=en&ct=clnk*

*Apple here:
https://developer.apple.com/legacy/...rwin/Reference/ManPages/man1/osascript.1.html*


----------



## max21 (Oct 28, 2017)

I took this down to the Userland Programming and Scripting forum for conversion help.

https://forums.freebsd.org/threads/63002/


----------



## max21 (Oct 28, 2017)

Those links really help:  Now I can do all of the things I always wanted to do, then exit 
*
Open any program or shell with a script*

```
#!/bin/sh
#
./test/d_start && exit

or

cd /usr/local/bin
./opera && exit
```
*Close any program or shell with a script*

```
#!/bin/sh
#
/usr/bin/pkill geany && exit

or

jail -r 1 && exit
```

No Python, No headache No nothing!


----------

