VLC command works in Terminal but not Automator If I run this in terminal it works fine

/Applications/VLC.app/Contents/MacOS/VLC -I rc http://open.live.bbc.co.uk/mediaselector/5/select/mediaset/http-icy-mp3-a/vpid/bbc_radio_fourfm/format/pls.pls --sout '#standard{mux=raw,access=file{overwrite},dst=/Users/person/Documents/scripts/r4.mp3,display=novideo}' --run-time=1800 --stop-time=1800


But if I run it in Automator (using Run Shell Script) I get this result and it doesn't work:

 "VLC media player 2.2.1 Terry Pratchett (Weatherwax)",
 "Command Line Interface initialized. Type `help' for help.
",
 "&gt; Shutting down.
"


I have messed around with PATH and .bash_profile to no avail. What am I doing wrong?
It's most likely due to the VLC RC client wanting an Xterm interactive shell instead of a non-interactive shell, or some weirdness with the VLC OS X app still attempting to launch (It's bouncing in my dock while it runs).

In any case, a simple work around is to have automator launch a script to run in terminal.

The script would be simply:

#/bin/bash
/Applications/VLC.app/Contents/MacOS/VLC -I rc http://open.live.bbc.co.uk/mediaselector/5/select/mediaset/http-icy-mp3-a/vpid/bbc_radio_fourfm/format/pls.pls --sout '#standard{mux=raw,access=file{overwrite},dst=/Users/person/Documents/scripts/r4.mp3,display=novideo}' --run-time=1800 --stop-time=1800


It should have execute permissions (chmod +x)

Then from Automator, you launch it like you normally would. In this case, I had Automator "Run Shell Script" of

open -a Terminal /path/to/script.sh


Note you may want to add the --play-and-exit option, otherwise VLC will stay open even after the 1800 seconds. By default, it will stop at the end of the playlist and wait. --play-and-exit will tell it to quit when the playlist ends (in this case a single file).

Alternatively, you can directly launch the script with a double click, skipping Automator completely, if you change the suffix to .command. That may be more direct, depending on your actual goal.