User:Rick Bot/scripts/getallpages

#!/bin/bash

# $1 is page to get
# $2 is namespace number
TMP=tmp.getpages

./getpages "$1" "$2" | tee $TMP 
LINES=`cat $TMP | wc -l`
LINES=`expr $LINES`
let LINES=$LINES-1
# echo LINES=$LINES >&2
while [ $LINES -eq 499 ]; do
  LAST=`tail -1 $TMP`
  LAST=`./urlencode "$LAST"`
# echo $LAST >&2
  ./getpages "$1" "$2" "$LAST" | sed -e '1d' | tee $TMP
  LINES=`cat $TMP | wc -l`
  LINES=`expr $LINES`
done