简体   繁体   English

如何在新标签页中执行命令?

[英]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? 如何在Shell脚本中执行此操作? I currently have the following code: 我目前有以下代码:

#! /bin/bash
mysqld &
redis-server

Each database needs its own tab. 每个数据库都需要自己的标签。 This is on OSX. 这是在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 ) (基于https://stackoverflow.com/a/7177891/1566267

The similar command is for redis-server . 类似的命令用于redis-server

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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