简体   繁体   中英

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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM