Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.