Maskiin
Maskiin

Reputation: 39

Getting error for tell application "iTerm2" script

I am trying to fire multiple iTerm2 tabs vertically and I get an error.

Here is the script I am running:

#/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

I am getting the following error:

./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

Upvotes: 0

Views: 297

Answers (1)

JRFerguson
JRFerguson

Reputation: 7516

This is an AppleScript, not a bash one.

Change the she-bang to:

#!/usr/bin/osascript

Upvotes: 2

Related Questions