目前,我有一个
sh
文件,我用它来运行这样的脚本:
osascript -e "tell application \"Terminal\" to do script \"cd $PWD && npm run build:watch\""
osascript -e "tell application \"Terminal\" to do script \"cd $PWD && firebase emulators:start --inspect-functions\""
这在默认终端下工作得很好。但是,我如何用 Iterm2 替换它呢?我似乎无法在网上找到任何答案。
如果我用
Terminal
替换 Iterm2
,我会收到此错误:
29:38: syntax error: A “script” can’t go after this identifier. (-2740)
29:38: syntax error: A “script” can’t go after this identifier. (-2740)
我的工作示例如下:
osascript -e 'tell application "iTerm" to activate' -e 'tell application "iTerm" to tell current session of current window to write text "echo \"WOW! It works\""'
因此,选项“-e”之后的每个块都是您想要执行的实际命令。
希望有帮助。