#!/bin/bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" if [[ "$#" -lt 1 ]]; then #if less than 1 echo "Usage: ./download.sh [name of file] " exit 2 fi if [[ "$#" -ne 2 ]]; then echo Downloading $1 youtube-dl -f 'bestaudio[ext=m4a]' "$1" --output "$DIR/%(id)s.%(ext)s" else echo Downloading $1 as $2 youtube-dl -f 'bestaudio[ext=m4a]' "$1" --output "$DIR/$2.%(ext)s" fi