4

I made an alias for youtube-dl with some options like that

yd="youtube-dl -cit -f 18"

so I can download it like

yd URL

I want to modify it to show only the two lines from the output using

grep -e "Downloading video #" -e ETA

I can make it in two aliases using the |

but is there a way to make it one alias

2
  • unclear for me. Explain a bit more. May 27, 2014 at 7:17
  • need instead of making 2 aliases and use them like ( alias1 URL | alais2 ) need to make it only one alias like alias1 URL
    – Fat Mind
    May 27, 2014 at 7:32

1 Answer 1

4

You might need to make a function since an alias does not support providing parameters directly.

Open your ~/.bashrc file and enter the following:

function yd() {
    youtube-dl -cit -f 18 $1 | grep -e "Downloading video #" -e ETA
}

and then source your ~/.bashrc file using:

source ~/.bashrc

and then you should be able to use yd URL to get the desired result.

1
  • 1
    @Jobin yes it works this time , thanks for the help
    – Fat Mind
    May 27, 2014 at 7:43

You must log in to answer this question.

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