#!/bin/sh

#This script parse the result.txt file 
#to judge whether the operation of sending file is successful

#The local do not have the Permission to access the remote directory
if [ `grep -c "handle" /tmp/result$1.txt` -gt 0 ] ; then
	`echo 4 >/tmp/temp$1.txt`
	#echo "The local do not have the Permission to access the remote directory"
	exit
fi

#The name or the password is not fit
if [ `grep -c "Permission denied" /tmp/result$1.txt` -gt 0 ] ; then
	`echo 2 >/tmp/temp$1.txt`
	#echo "The name or the password is not fit"
	exit
fi

#Successful
if [ `grep -c "100%" /tmp/result$1.txt` -gt 0 ] ; then
	`echo 0 >/tmp/temp$1.txt`
	#echo "Send the file successfully"
	exit
fi

#The remote server is unavailable
        `echo 1 >/tmp/temp$1.txt`
        #echo "The remote server is unavailable"
        exit

