Created
March 20, 2020 19:14
-
-
Save colindekker/99ab6c6879d4504c56cda53be8b7fe7e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
INPUT=samples.csv | |
mkdir "$HOME/samples" | |
cd "$HOME/samples" | |
curl "https://gist.githubusercontent.com/colindekker/c3e892355f041910af2c4cad40621ddc/raw/8e18d947bc050fcb51031437deae654712e8f287/gistfile1.csv" --output $INPUT | |
OLDIFS=$IFS | |
IFS=',' | |
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; } | |
while read Url | |
do | |
echo "Url : $Url" | |
MP3_NAME="$(echo $Url | rev | cut -d '/' -f1 | rev)" | |
echo $MP3_NAME | |
curl $Url --output $MP3_NAME | |
done < $INPUT | |
IFS=$OLDIFS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment