macos - 使用 osascript 脚本打开终端并运行 npm 命令
问题描述
我不太喜欢 max unix 命令。
我想要做的是打开两个不同的终端并在每个终端中运行 npm。
echo "Starting typescript build in new terminal.."
osascript -e 'npm run build'
sleep 3
echo "Starting firebase functions...."
osascript -e 'firebase emulators:start --only functions'
echo "Process compelete.. Check if there were two terminals window open"
这就是我写的,这就是我在终端中得到的
Starting typescript build in new terminal..
8:13: syntax error: Expected “given”, “with”, “without”, other parameter name, etc. but found identifier. (-2741)
Starting firebase functions....
0:18: syntax error: A identifier can’t go after this identifier. (-2740)
Process compelete.. Check if there were two terminals window open
有人可以帮我纠正我的 shell 脚本吗
解决方案
像这样:
osascript -e 'tell application "Terminal" to do script "cd && npm run build"' &
osascript -e 'tell application "Terminal" to do script "cd && firebase emulators:start --only functions"' &
推荐阅读
- nginx - 使用 nodeport 访问 Kubernetes 服务返回连接被拒绝
- scala - 生成创建类的应用方法
- linux - 带有 Realm 数据库的 Linux 应用程序
- arrays - 将数组传递给bash脚本中的函数
- prometheus - 使用 Python 在 Prometheus 中编写多个自定义收集器
- objective-c - @property(复制)与方法 [复制]
- python - 获取无效参数:在 keras 中使用 IoU 度量时,所有输入的形状必须匹配:values[0].shape = [401408] != values[1].shape = [24485888]
- android - 当来自原生 android 方法通道的回调时,在 dart 中运行方法或函数
- go - 为什么我不能从 grpc 得到非零响应和错误
- javascript - 排除不适用于尝试从包中排除非 node_modules 脚本