I have a do shell script which can produce errors. I need to ignore the errors so I have put it into a try/end try block. But, I need to get the standard output into a variable when there is an error (and when not). This is the code I have which does work - result goes into get_result which I use elsewhere in the script:
try
set get_result to do shell script "[my shell command] 2>&1"
on error errStr
set get_result to errStr
end try
It seems odd that if there is an error in the shell command, standard output is not normally available to AppleScript unless it is combined with standard error. Is there a better way of doing this ?
Thanks.