What I'm doing
I'm using iTerm2 Build 3.0.15 and writing a script that opens a new window and prints "hello world" to the screen. Really, I'm interested in being to run any command but using echo "hello world"
as a starting point.
What I've tried
I read up on the iTerm2 documentation for scripting. I wanted to learn more so I dragged the iTerm2
icon on the Script Editor
icon to view the dictionary available to me and found the following command:
From reading the dictionary and documentation I wrote the following script:
tell application "iTerm"
create window with default profile command "echo hello world"
end tell
When I run my script from the terminal a new window opened and "hello world" was on the screen; however, I got the following broken pipe error:
When I select Ok
the window closed and I'm left with the following message:
$ osascript iterm.applescript
window id 6415
The Questions
- What do these broken pipe and window id 6415 errors mean?
- How do I write a script that opens an iTerm2 window and runs a command?