if [ $# -eq 0 -o $# -gt 3 ] ; then
echo "Usage: $0 <remote-host> <remote-dir> [<local-dir>]"
exit 1
fi
LOCALDIR=./$2
if [ $# -eq 3 ] ; then
LOCALDIR=./$3
fi
if [ -e $LOCALDIR ] ; then
rm -rf $LOCALDIR
fi
mkdir -p $LOCALDIR
cd $LOCALDIR
for ((;;))
do
LOGFILE=$LOGDIR/$LOGNAME-$LOGNO.$LOGEXT
if [ ! -e $LOGFILE ]; then
touch $LOGFILE
break
fi
LOGNO=$(($LOGNO+1))
done
----------------------------------------------------------------------