Home > Enterprise >  Getting error for tell application "iTerm2" script
Getting error for tell application "iTerm2" script

Time:10-07

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

CodePudding user response:

This is an AppleScript, not a bash one.

Change the she-bang to:

#!/usr/bin/osascript
  • Related