#!/bin/sh set -euf # absolute paths script="$(realpath $0)" tools="$(dirname "${script}")" src="$(dirname "${tools}")" doc="${src}/doc" documents=' ft232r.pdf https://www.ftdichip.com/old2020/Support/Documents/DataSheets/ICs/DS_FT232R.pdf ' mkdir -pv "$doc" echo "$documents" | while read line do if [ "$line" == '' ] then continue fi name="$(echo "$line" | cut -d$'\t' -f1)" url="$(echo "$line" | cut -d$'\t' -f2)" path="${doc}/${name}" if [ ! -f "$path" ] then curl "$url" > "$path" fi done