#!/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 9dc583a87fdd8cc20f538197bb4cf807 ' 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)" checksum="$(echo "$line" | cut -d$'\t' -f3)" path="${doc}/${name}" if [ ! -f "$path" ] then curl "$url" > "$path" fi if [ "${checksum} ${path}" == "$(md5sum "$path")" ] then echo "OK ${name}" else echo "NOT OK ${name}" fi done