Skip to content

Instantly share code, notes, and snippets.

@colindekker
Created March 20, 2020 19:14
Show Gist options
  • Save colindekker/99ab6c6879d4504c56cda53be8b7fe7e to your computer and use it in GitHub Desktop.
Save colindekker/99ab6c6879d4504c56cda53be8b7fe7e to your computer and use it in GitHub Desktop.
#!/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