I have an alias
for youtube_dl
which adds some arguments in my .bashrc
file. I want to run this in a separate terminal similar to how it is done here. The problem is that this takes a string as input.
my current alias:
alias youtube-dl="youtube-dl -ci --restrict-filenames -o '%(title)s.%(ext)s'"
how I want the new alias to look like:
alias youtube-dl='gnome-terminal -e "youtube-dl -ci --restrict-filenames -o '%(title)s.%(ext)s'"'
The problem is, however, that now the '
-strings are interpreted as two separate strings. In addition, I am now unable to add the url as an argument. How do I circumvent this?
Best Answer
You could mess around with quotes and escaping, but I prefer to look for ways to reduce the quoting levels. For example, you could use
gnome-terminal -x
instead:So,
Becomes:
Shaving off one layer of quotes. And the alias would be:
Or you could use a function: