Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

yagoa

macrumors newbie
Original poster
Dec 9, 2011
2
0
What should I use instead of "echo" to pass the URL to a terminal program?
Screen Shot 2017-05-06 at 21.18.45.png
 

superscape

macrumors 6502a
Feb 12, 2008
937
223
East Riding of Yorkshire, UK
Hi,

I'm guessing you're wanting to pass the URLs to "youtube-dl" as a parameter, right? Also, I'm assuming that if you type:

youtube-dl "http://some.valid.url/whatever"

...then it works for you.

In which case, the passed arguments come in as the variable $@. So you need to loop through the list like this:

Code:
for f in "$@"
do
  #your download code goes here
  youtube-dl "$f"
done

I wrote a short guide to doing this a little while ago here:

https://www.ghostotter.com/making-shell-scripts-little-user-friendly/

...you may find it useful!

Good luck.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.