gopherdl (428B)
1 #!/bin/sh 2 3 [ -z $1 ] && printf "download files from a gopher menu\nusage: gopherdl <uri>\n" && exit 4 5 curl $1 | tr -d '\r' | sed "/^\./d;s/^./& /" | awk -F" " '$1 != "1" {print "gopher://"$4":"$5"/"$1$3}' | while IFS= read -r uri 6 do 7 fname=$(echo "$uri" | sed 's~gopher://[^/]*~~;s~^/[A-Za-z0-9]/~~') 8 dir=$(dirname "$fname") 9 [ "$dir" != "" ] && [ "$dir" != "$fname" ] && mkdir -p $dir 10 echo "$fname" 11 curl "$uri" > $fname 12 done