#!/bin/bash
if [ "$1" == "" ] ;then
echo "not arg"
exit 1
fi
files=""
for inFile in $*
do
fileName=${inFile##*/}
echo "filename:" ${fileName}
if [ "${fileName}" == "${inFile}" ]; then
file=`pwd`"/"${inFile}
else
filePath=${inFile%/*}
cd ${filePath}
file=`pwd`"/"${fileName}
fi
files=${files}" "${file}
done
echo "files:" ${files}
#OLD=`md5sum ${FILE}`
#echo ${OLD}
#vim ${FILE}
#NEW=`md5sum ${FILE}`
#NEW=${OLD}
for file in ${files}
do
echo "file" ${file}
sftp root@192.168.29.12 << EOF
put ${file} ${file}
quit
EOF
sftp root@192.168.29.14 << EOF
put ${file} ${file}
quit
EOF
done
echo "exit vim"