#!/bin/bash function helpexit() { echo "Print or download URLs with consecutive numbers" echo "usage example, Download files: $0 http://etc/ 01 .jpg 30 wget" echo "usage example, Print URLS: $0 http://etc/ 001 .jpg 30 echo" echo "length of first number as a string defines padding" exit } [[ -z "$1" ]] && helpexit [[ "$1" = "-h" ]] && helpexit jotai="$1" paate="$3" # From i=$( echo $2 | sed 's,^0\+,,' ) if [ "$i" = "" ] then i=0 fi # To t=$4 # xargs to comm=$5 pad=${#2} if [ -z "$comm" ] then comm="echo" fi while [ "$i" -le "$t" ] do j=$( printf "%0${pad}d" $i ) if [ "$comm" = "wget" ] then echo oo # wget -S --spider | grep __error codes.. (or OK) wget -U 'Mozilla/4.0 (compatible: MSIE 5.5: Windows NT 5.0)' --referer="${jotai}${j}${paate}" "${jotai}${j}${paate}" else echo ${jotai}${j}${paate} | xargs $comm fi let "i = 1 + $i" done