Solving “zsh: no matches found” error when running youtube-dl mp3 extract task. Here is my bash script on my Macbook :
#!/bin/bash
URL=$1
# function: guide
guide () {
echo "Youtube URL is required."
}
# function: download audio and convert to mp3
download_and_convert() {
youtube-dl -f bestaudio --extract-audio --audio-format mp3 $URL
}
# check parameter
if [ $# = 0 ]; then
guide
else
download_and_convert
fi
Usage: getaudio youtube-url
and I met the error message: zsh: no matches found
I got fixed by a single quote for the youtube-url.
Usage: getaudio ‘youtube-url’ ( youtube-dl ‘{video_url}’)