tell application "iTerm2" 脚本出错

Getting error for tell application "iTerm2" script

我试图垂直触发多个 iTerm2 选项卡,但出现错误。

这是我的脚本 运行:

#/bin/bash

tell application "iTerm2"
    tell current session of current tab of current window
        write text "ssh host"
        repeat 1 times
          split vertically with default profile
        end repeat
    end tell
    tell second session of current tab of current window
        write text "ssh host"
    end tell
end tell

我收到以下错误:

./iterm2.sh: line 3: tell: command not found
./iterm2.sh: line 4: tell: command not found
write: text is not logged in on ssh host
./iterm2.sh: line 6: repeat: command not found
split: vertically: No such file or directory
./iterm2.sh: line 8: end: command not found
./iterm2.sh: line 9: end: command not found
./iterm2.sh: line 10: tell: command not found
write: text is not logged in on ssh host
./iterm2.sh: line 12: end: command not found
./iterm2.sh: line 13: end: command not found

这是 AppleScript,不是 bash。

将 she-bang 更改为:

#!/usr/bin/osascript