Take the 2-minute tour ×

I have a script that starts pianobar (pandora player) and autoloads into tty2 after booting. I'm running Ubuntu Precise 12.04.

it's a pretty simple script:

    sleep 5
    echo "2" | pianobar

This works, it selects station 2 and begins playing... but when I try to type in commands it doesn't work (like pushing "p" for pause.) It'll show the letter for a second, then hide it. If I try to exit with ctrl+z it just sits there and I can't use it at all.

If I run this it works fine but doesn't auto-select the second station:

    sleep 5

Is there anyway to write this so it will automatically input "2" and then allow me to control from there? Or am I stuck with having to select 2 every time I boot up?


I modified it to this:

    sleep 5
    { echo 2 ; cat ; } | pianobar

and it does the exact same thing as just "echo 2 | pianobar"

"Isn't there an option to pianobar to start with a default station"

I would of thought so, but I can't find a command for a default setting when I do "man pianobar"

When I open the program, it does a login and then the program starts with "Select station:" I'd like for it to automatically go into the 2nd station.

share|improve this question
add comment

1 Answer

What happens is that you link the stdout of echo with the stdin of pianobar, but then echo exits and the stream is gone. Try that:

{ echo 2 ; cat ; } | pianobar

My main question, however, would be -- what are you trying to achieve? Why not start just the pianobar? Isn't there an option to pianobar to start with a default station, if that's the problem?

share|improve this answer
add comment

Your Answer


