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!

link|improve this question
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.