How can you automatically escape special characters in a string that is pasted into terminal?

Viewed 1429

I have the CLI utility "youtube-dl" installed. It takes a urls as arguments. It is most natural to paste these urls from the system clipboard. Using zsh, however, this returns an error "no matches found" because the special characters in youtube urls are not escaped.

I need to go from this:

https://www.youtube.com/watch?v=ShxHGFs2IKE

to this:

https\:\/\/www\.youtube\.com\/watch\?v=ShxHGFs2IKE

It is quite a pain to manually escape all the characters every time, so my question is: how can I make this work without all the manual editing of urls each time?

1 Answers
Related