如何 运行 一个终端中的服务器并打开另一个终端和 运行 使用 bash 脚本的客户端?
how to run a server in one terminal and open another terminal and run the client using bash scripting?
我使用 ubuntu 20.04,使用 bash shell 脚本我想 运行 一个终端中的服务器并打开另一个终端和 运行 client.I 尝试使用 gnome-terminal 并没有解决问题。
#!/bin/bash
cd clustermanagement
go run server/main.go
gnome-terminal -x sh -c "go run client/main.go;bash"
我尝试使用其他命令,例如 gnome-terminal --bash -c "go run client/main.go; bash"
没用。
服务器启动 运行ning,然后如果按 Ctrl+c
并停止服务器,则只有客户端处于 运行ning。
我希望服务器 运行 自动打开一个新终端,客户端应该 运行!
为什么不尝试 运行 在后台使用“&”的服务器
编辑:看起来是@Marc 先搞定的。
我使用 ubuntu 20.04,使用 bash shell 脚本我想 运行 一个终端中的服务器并打开另一个终端和 运行 client.I 尝试使用 gnome-terminal 并没有解决问题。
#!/bin/bash
cd clustermanagement
go run server/main.go
gnome-terminal -x sh -c "go run client/main.go;bash"
我尝试使用其他命令,例如 gnome-terminal --bash -c "go run client/main.go; bash"
没用。
服务器启动 运行ning,然后如果按 Ctrl+c
并停止服务器,则只有客户端处于 运行ning。
我希望服务器 运行 自动打开一个新终端,客户端应该 运行!
为什么不尝试 运行 在后台使用“&”的服务器
编辑:看起来是@Marc 先搞定的。