I'm trying to set variables in Automator but apparently it's not working? It only outputs the latest variable; "Var2". What am I doing wrong?
This is what I'm trying to do
for f in "$@"
do
echo "$1" "$2"
done
The following Automator workflow works for me with the following actions, and make note of the Options settings:
Run Shell Script
Shell: [/bin/bash] Pass input: [as arguments]
echo "$1" "$2"
In the Results pane of the Run Shell Script action it shows what was typed in both Ask for Text actions, which were of course set to the Set Value of Variable actions.
For example, I typed "This is Var1" and "This is Var2" respectively, and the Results pane of the Run Shell Script action showed:
This is Var1 This is Var2
Note in the image below that I did not check the [] Require an answer check box in the Ask for Text action's Options, however this was just for testing and I did add text in each instance. For the real thing, you may want to check that check box.
Also note that by checking the [√] Ignore this action's input check box in the given actions, there is a break between that action and the previous action as noted by no visible connection compared to the ones that are visibly connected.