2

I want to run a command within an iTerm2 session like this:

tell application "iTerm"
  tell session id "/dev/ttys020"
    exec command "ls"
  end
end

But I get the following error (with and without '/dev' in the tty name)

227:255: execution error: iTerm got an error: Can’t get session id "/dev/ttys020". (-1728)

The name is the one given by the tty. I also run this script to make sure that I am using the right id:

  tell application "iTerm"
    tell the current terminal
        tell the current session
            display dialog (get id)
        end
    end
  end 

Actually, I am not sure if the command must be sent to a session or to a terminal, but I cannot manage to find a tty and send a command to it.

You must log in to answer this question.

Browse other questions tagged .