#!/bin/sh useasp=`has-asp` download() { if [ "$useasp" == "true" ] then asp-ls "pubmed/$1" | grep -v ".md5" | grep "xml.gz" | asp-cp "pubmed/$1" else ftp-ls ftp.ncbi.nlm.nih.gov "pubmed/$1" | grep -v ".md5" | grep "xml.gz" | ftp-cp ftp.ncbi.nlm.nih.gov "pubmed/$1" fi } if [ "$#" -eq 0 ] then echo "Must indicate either baseline or updatefiles" exit 1 fi while [ "$#" -gt 0 ] do sect="$1" shift download "$sect" if [ $? -ne 0 ] then download "$sect" fi done