At one point in an applescript, I call a a shell script that gives me some feedback. Is there a way to output what’s being printed to stdout in real time rather than all of it at once when the script finishes?
Not directly. Your script doesn’t continue until the shell script terminates, at which point the stdout is passed back to your script.
do shell script doesn’t pass back stdout as the command executes.
About the closest you can get is to redirect output to a file and use a terminal window to ‘tail -f’ the file. that way the tail will display the updates to the file:
do shell script "touch /var/tmp/shell.out" -- make sure the file exists tell application "Terminal" to do script "tail -f /var/tmp/shell.out" -- tail the file do shell script "blah > /var/tmp/shell.out" -- run the shell command
How can I get it to close the terminal window when the script called is done though? Sopmething like sending a ^C to the same window and then quitting it.