两种实现方式:

  1. shell脚本直接调用一个脚本
  2. shell脚本新建终端执行一个脚本

1. shell脚本直接调用一个脚本

shellPath.sh
# main shell script call other shell script
echo "main shell execute....[`date "+%Y-%m-%d %H:%M:%S"`]"
~/Desktop/otherShell.sh
echo "main continue...[`date "+%Y-%m-%d %H:%M:%S"`]"
# other shell
sleep 3
echo "other shell execute....[`date "+%Y-%m-%d %H:%M:%S"`]"

请添加图片描述

2. shell脚本新建终端执行一个脚本

open -a Terminal.app shellPath.sh

注:开启一个终端运行脚本后,此脚本便继续运行后面的命令,不会等待另一个脚本运行完.

# main shell script call other shell script
echo "main shell execute....[`date "+%Y-%m-%d %H:%M:%S"`]"
open -a Terminal.app ~/Desktop/otherShell.sh
echo "main continue...[`date "+%Y-%m-%d %H:%M:%S"`]"
# other shell
sleep 3
echo "other shell execute....[`date "+%Y-%m-%d %H:%M:%S"`]"

请添加图片描述

原文地址:https://blog.csdn.net/sinat_38483976/article/details/129158901

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任

如若转载,请注明出处:http://www.7code.cn/show_45608.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱suwngjj01@126.com进行投诉反馈,一经查实,立即删除

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注