2018-10-20 22:37:27 +00:00
|
|
|
while [[ $# -gt 0 ]]
|
|
|
|
do
|
|
|
|
key="$1"
|
|
|
|
|
|
|
|
case $key in
|
|
|
|
--srcdir)
|
|
|
|
srcdir="$2"
|
|
|
|
shift # past argument
|
|
|
|
;;
|
|
|
|
--dstdir)
|
|
|
|
dstdir="$2"
|
|
|
|
shift # past argument
|
|
|
|
;;
|
|
|
|
--key)
|
|
|
|
key="$2"
|
|
|
|
shift # past argument
|
|
|
|
;;
|
|
|
|
--ssh)
|
|
|
|
ssh="$2"
|
|
|
|
shift # past argument
|
|
|
|
;;
|
|
|
|
--file)
|
|
|
|
file="$2"
|
|
|
|
shift # past argument
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# unknown option
|
|
|
|
if test -z "${unknown}"
|
|
|
|
then
|
|
|
|
unknown=$1
|
|
|
|
else
|
|
|
|
echo "Unknown Option"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift # past argument or value
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
cd $dstdir
|
|
|
|
sermons=$(ls $srcdir)
|
2018-09-30 01:06:38 +00:00
|
|
|
IFS=$'\n'
|
|
|
|
lastsermon=$(echo "${sermons[*]}" | sort -nr | head -n1)
|
2018-10-20 22:37:27 +00:00
|
|
|
cp $srcdir/$lastsermon .
|
2018-09-30 01:06:38 +00:00
|
|
|
|
2018-10-20 22:37:27 +00:00
|
|
|
rsync --update --progress -e "ssh -i $key" *.mp3 $ssh:$dstdir
|
2018-09-30 01:06:38 +00:00
|
|
|
|
2018-10-20 22:37:27 +00:00
|
|
|
sermons=$(ssh -i $key $ssh 'ls $dstdir')
|
2018-09-30 01:06:38 +00:00
|
|
|
IFS=$'\n'
|
|
|
|
recentsermon=$(echo "${sermons[*]}" | sort -nr) #| head -n2)
|
|
|
|
echo $recentsermon
|