connect to mpd with password

Need help with MPD?
Post Reply
mcdoof
Posts: 4
Joined: May 14th, 2020, 3:33 pm

connect to mpd with password

Post by mcdoof »

hi,
I cant figure out how i can change this code echo -e "status\\nclose" | nc localhost 6600 that its connect with a password.
I know how to connect with password echo -e password somepassword | nc localhost 6600 but how can I concate both commands in a single line?

Thanks for tips.

max
Forum team
Posts: 1063
Joined: January 15th, 2013, 3:43 pm

Re: connect to mpd with password

Post by max »

I'm confused by your question. You know how to concatenate the commands "status" and "close", but you don't know how to concatenate "password", "status" and "close"?

mcdoof
Posts: 4
Joined: May 14th, 2020, 3:33 pm

Re: connect to mpd with password

Post by mcdoof »

Sorry I just copied this from a script that I found on the net. Did not realize that nclose was a command. Thanks.
So it should work like this password somepassword\\status\\nclose" right?

mcdoof
Posts: 4
Joined: May 14th, 2020, 3:33 pm

Re: connect to mpd with password

Post by mcdoof »

tried this password somepassword\\status\\nclose" but it did not work. It says wrong password.

max
Forum team
Posts: 1063
Joined: January 15th, 2013, 3:43 pm

Re: connect to mpd with password

Post by max »

"nclose" is not a command. "close" is a command. "\\n" is a (doubly) escaped newline character.
Your problem is not about MPD, but about basic shell usage. This is not the place to learn about your shell.

mcdoof
Posts: 4
Joined: May 14th, 2020, 3:33 pm

Re: connect to mpd with password

Post by mcdoof »

Thank you. You helped me a lot.

Post Reply