1

In bash script if we type vlc -q command we get:

VLC media player 2.0.8 Twoflower (revision 2.0.8a-0-g68cf50b)
VLC media player 2.0.8 Twoflower
Command Line Interface initialized. Type `help' for help.
> 

and It wait for get new command like help or info, I want some script do these two steps in one step something like this

 vlc -q < info

Is there any way to do this?

user3726821
  • 123
  • 1
  • 12
  • On VLC 2.1.x, `vlc -q` summons the GUI. Are you in a non-GUI environment? – konsolebox Aug 03 '14 at 15:12
  • 1
    possible duplicate of [passing arguments to an interactive script non interactively](http://stackoverflow.com/questions/14392525/passing-arguments-to-an-interactive-script-non-interactively) – Tom Fenech Aug 03 '14 at 15:26
  • If it is an additional requirement that there is some delay in between the two commands (as you have indicated in the comments below), you should edit your question to specify that. Otherwise, this question is no different to the duplicate I have suggested and should be closed as such. – Tom Fenech Aug 03 '14 at 16:25
  • @TomFenech I can assure you that it can't be a duplicate as `vlc` has some additional requirements besides that. And I'm just waiting for the OP to actually notice it. For now I'll just follow his requirements. – konsolebox Aug 03 '14 at 16:42
  • @konsolebox I'm not sure what you mean. What are these additional requirements? More generally, why wouldn't you make your answer as comprehensive as possible in the first place? Short of a `sleep`, which isn't even a requirement mentioned in the question, these answers add nothing new. – Tom Fenech Aug 03 '14 at 16:56
  • @TomFenech Because it might be unnecessary (i.e. unrelated) as his VLC doesn't seem to behave like it. I only give out my treasures when needed :) – konsolebox Aug 03 '14 at 17:10
  • vlc -q take some moment to get value from online stream,Now sleep need to take this process. – user3726821 Aug 03 '14 at 19:20

2 Answers2

2

You most likely, meant to do this:

vlc -q <<< "info"

Update:

vlc -q < <(sleep 4s; echo "info")
(sleep 4s; echo "info") | vlc -q
Cartier
  • 429
  • 4
  • 15
konsolebox
  • 72,135
  • 12
  • 99
  • 105
1

You can't use command < "string", you must use echo instead:

echo "info" | vlc -q

EDIT:
If you want the echo command to be executed after a amount of time, write:

(sleep <time>; echo "info") | vlc -q
msrd0
  • 7,816
  • 9
  • 47
  • 82