pmdaly
pmdaly

Reputation: 1212

How to execute commands in new tabs?

I want to start two different databases but want to keep each process running in a separate tab in a terminal. How do I do this within a shell script? I currently have the following code:

#! /bin/bash
mysqld &
redis-server

Each database needs its own tab. This is on OSX.

Upvotes: 1

Views: 495

Answers (1)

John_West
John_West

Reputation: 2399

osascript -e 'tell application "Terminal" to activate' -e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down' -e 'tell application "Terminal" to do script "mysqld" in selected tab of the front window'

(based on https://stackoverflow.com/a/7177891/1566267)

The similar command is for redis-server.

Upvotes: 1

Related Questions