Home > front end >  macos shell prompt for input then execute
macos shell prompt for input then execute

Time:09-30

What am I missing to have the final output execute? This works in that it prompts for the url and builds the full command which also works if I copy and paste to terminal but executing this all it does is show the command and does not execute it?

 #! /bin/bash

    echo "paste youtube url"
    read URL
    printf "yt-dlp -f 'bv*[ext=mp4] ba[ext=m4a]/b[ext=mp4] / bv* ba/b' $URL \n"

when I run

 #! /bin/bash

    echo "paste youtube url"
    read URL
"yt-dlp -f 'bv*[ext=mp4] ba[ext=m4a]/b[ext=mp4] / bv* ba/b' $URL"

I get No such file or directory even though the output can be copied and run in another terminal and it runs fine.

CodePudding user response:

This worked, I had the quotes wrong

#! /bin/bash

echo "paste youtube url"
read URL
yt-dlp -f 'bv*[ext=mp4] ba[ext=m4a]/b[ext=mp4] / bv* ba/b' "$URL"

CodePudding user response:

yt-dlp -f 'bv*[ext=mp4] ba[ext=m4a]/b[ext=mp4] / bv* ba/b' $URL 

Drop the print command and remove the double quotes -- You MAY use them around the $URL --> "$URL" if you wish .. But they are not neccessary.

#! /bin/bash

echo "paste youtube url"
read URL
yt-dlp -f 'bv*[ext=mp4] ba[ext=m4a]/b[ext=mp4] / bv* ba/b' $URL

Tested and functioning on OS12 Monterey.

  • Related