【问题标题】:Use osascript script to open terminal and run npm command使用 osascript 脚本打开终端并运行 npm 命令
【发布时间】:2020-06-26 00:55:45
【问题描述】:

我不太会使用 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 脚本吗

【问题讨论】:

    标签: macos unix npm


    【解决方案1】:

    像这样:

    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"' &
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-05-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多