Closed incandescentman closed 7 years ago
This is a shell thing, and not super easy to work around. Could you try
$ spotify play "wouldn't it be nice"
and see if that does what you want?
This will probably be shell specific (in my case bash), but here's what's working for me:
$ spotify play wouldnt it be nice
Searching tracks for: wouldnt it be nice
Playing (wouldnt it be nice Search) -> Spotify URI: spotify:track:2Gy7qnDwt8Z3MNxqat4CsK
$ spotify play "wouldn't it be nice"
Searching tracks for: wouldn't it be nice
Playing (wouldn't it be nice Search) -> Spotify URI: spotify:track:2Gy7qnDwt8Z3MNxqat4CsK
$ spotify play wouldn't it be nice
→ '
Searching tracks for: wouldnt it be nice
Playing (wouldnt it be nice Search) -> Spotify URI: spotify:track:2Gy7qnDwt8Z3MNxqat4CsK
The last one works by using another apostrophe. You just need to close the apostrophe since the shell thinks it's a single quote. You can use as many apostrophes as you need as long as there is an even number. So this works (' * 8):
$ spotify play wouldn't it be nice'''''''
Searching tracks for: wouldnt it be nice
Playing (wouldnt it be nice Search) -> Spotify URI: spotify:track:2Gy7qnDwt8Z3MNxqat4CsK
but this doesn't (' * 7):
$ spotify play wouldn't it be nice''''''
→ '
Searching tracks for: wouldnt it be nice
Playing (wouldnt it be nice Search) -> Spotify URI: spotify:track:2Gy7qnDwt8Z3MNxqat4CsK
The solution is to escape single quotes like this:
$ spotify play wouldn\'t it be nice
Searching tracks for: wouldn't it be nice
Playing (wouldn't it be nice Search) -> Spotify URI: spotify:track:2Gy7qnDwt8Z3MNxqat4CsK
Within shpotify, it's probably possible to escape inputs. Here's how that would be done in the shell:
$ inputvar="wouldn't it be nice"
$ output="${input//"'"/"\'"}"
$ echo $output
wouldn\'t it be nice
OK great, using quotation marks works, as does omitting the apostrophe! (Those are both much more intuitive than closing the single quote.) Thanks!
shpotify is brilliant! Amazing work. Question:
$ spotify play wouldnt it be nice
works, but if I use an apostrophe and do$ spotify play wouldn't it be nice
it puts me in some kind of process that gives me a>
and won't accept commands.