Hi,
Im trying to add some validation into my shell script code that basically checks whether a directory exists before SFTP'ing a file to it. If the directory exists then it will add the file, if not then it should return some kind of message. This is the code I have written so far but with no success:
sftp ${SFTP_ACCOUNT}@${SFTP_ADDR} >${ERROUT} 2>&1 <<EOF
#echo $SFTP_DESTINATION
if [-d $SFTP_DESTINATION && echo "directory exists"];
then
put ${SOURCE_FILE_NAME} ${SFTP_DESTINATION}
else
echo "Remote Directory ${SFTP_DESTINATION} does not exist"
fi
bye
EOF
Any ideas on how i do this would be greatly appreciated!
Thanks,
Jack