Passing arguments to ‘Run Shell Script’ in Automator

automatorscriptterminal

I want to make an Automator workflow to run a shell command. For example, I want to receive text input from the user and treat that input as a shell command instead of text. I have tried passing argument as stdin but still not able to make it work. Here is a simple example of what I am trying to do:

The user input some text, say, 'xyz'. I want to pass this text to shell script as follow

echo "$1/"

to get xyz as the output of the shell script to show in show result action of Automator.

Best Answer

When passing input to Run Shell Script in Automator you need to change Pass input: to stdin to Pass input: as arguments as shown in the example workflow below.

enter image description here