Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to get the output of a shell command run through iTerm2's applescript into an applescript variable. I tried the following but it does not work:

tell application "iTerm"
  activate
  try
    set _session to current session of current terminal
  on error
    say "Error"
  end try
  tell _session
    set Directory to write text "pwd"
    get Directory
    set Directory to exec command "pwd"
    get Directory
  end tell
end tell

Thanks for your help!

share|improve this question

You must log in to answer this question.

Browse other questions tagged .