2

Me being the lazy bum that I am, wanted to make youtube-dl (the script that downloads youtube videos) execute upon pressing a hotkey for the current link in clipboard. In my keyboard shortcuts i made:

gnome-terminal -e  "youtube-dl --extract-audio --audio-quality 0 --audio-format mp3 $(xclip -o)"

This command works if i enter it into a seperate terminal, but when i execute the hotkey, the terminal appears for <1 second, and the script does not execute.

Can anyone point me as to where im going wrong? :)

2
  • 1
    probably $(xclip -o) doesn't get substituted. Try gnome-terminal -x /bin/sh -c "youtube-dl --extract-audio --audio-quality 0 --audio-format mp3 $(xclip -o)"
    – user448115
    May 24, 2016 at 16:39
  • It works! thanks so much! :) I'll be happy to accept your answer as best if you post it as an answer!
    – Wboy
    May 24, 2016 at 16:42

1 Answer 1

0

As command substitutions are performed by the shell, you have to execute your command as an argument to the shell:

gnome-terminal -x /bin/sh -c "youtube-dl --extract-audio --audio-quality 0 --audio-format mp3 $(xclip -o)"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .