Apple - Show Results of Automator-Terminal command
If you only have a few lines of output, you'd want to assign it to a variable and then display a confirmation dialog showing the output.
- add Action "Set Value of Variable"
- enter a new variable, e.g.
output
- add Action "Ask for Confirmation"
- in the message field, enter the variable name declared above. While typing the variable name, Automator will suggest to complete the variable name. Accept by pressing Enter key. This prevents Automator from interpreting the variable name as a plain text message.
This will look like this:
NB: I also tried the $1
approach, but did not succeed.
If you have a lot of lines of output, you should direct all output into a new TextEdit document. To do so, just add the "New TextEdit Document" Action after your script action.
This may look like this:
Hint: diagnostic messages are often output to standard error. To also collect text send to standard error, add exec 2>&1
at the top of your bash script.
There are a couple of ways you could do this:
- Adding an Ask for Confirmation action after the Run Shell Script one and using
$1
in the message field. - Adding another Run Shell Script and executing
osascript -e 'tell app "System Events" to display dialog "$1"'
. You'll have to select as argument on the pass input drop down.