I have an "ask for finder items" step in my Automator workflow, which produces a list of files selected by the user.

I then use these files as an input for a second step.

At that point I need to execute a bash command (third step).

In the fourth step, I need to use the original list of files as an input. How do I refer to it in Automator? Is there any pass-through for inputs?

Please note that re-ordering the steps is not an option.

UPDATE: It seems the proposed solution does not work for me:

enter image description here

  • Can you get your first list of files, and can store this in a temporary text file, and then subsequently steps further down the line can point to this file for input?
    – stuffe
    Commented Feb 14, 2012 at 17:47
  • But why wouldn't the get/set variable steps work as expected? Commented Feb 14, 2012 at 20:06

1 Answer 1


It's very easy to do this; all you need to do is use the 'Set Value of Variable', execute your bash script, then use 'Get Value of Variable'. You can also set multiple variables, name them, etc. as you need. Take a look at the quick example I created, which should resemble what you are intending to do. You'll notice that after I set the variable my bash script searched for files elsewhere, then after that was completed I easily recalled the variable (files a, b, c).

Automator Bash Scripting with Variables

  • Ah! Apparently I'm too old for drag'n'drop programming. Thank you for the very detailed reply. Commented Feb 4, 2012 at 9:46
  • Unfortunately, this doesn't seem to work for me. See update. Commented Feb 14, 2012 at 17:39
  • 3
    @RobertoAloi, — Marking the answer 'not-correct' because your script doesn't work is ridiculous. The answer is correct, although without seeing your script there is no telling why you're getting the error.
    – l'L'l
    Commented Feb 22, 2012 at 20:55
  • Even if you leave the script to a mere 'cat', the solution doesn't work for me. I've voted up your question because it's very detailed and explains the concept, but I didn't feel marking it as "accepted" straight away because it didn't work for me and it would discourage other users to post alternative solutions. I will mark it as accepted in a couple of days as "best answer" if no other answers are available. Said that, there's a section in the FAQs about etiquette and rudeness, which you might want to read: apple.stackexchange.com/faq#etiquette Commented Feb 23, 2012 at 11:07
  • 2
    Simply put, I answered your question — correctly. Maybe if you would have asked it differently my response would have been more to your liking. Also, I don't need to read the FAQ, since you obviously have the definition of 'helpfulness' mixed up with 'rudeness'.
    – l'L'l
    Commented Feb 26, 2012 at 9:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .