#!/usr/bin/bash
#to backup one more files
#asha 2017/4/17
if [ $# \< 1 ]
then
echo please give at least one existed file you wanna backup
fi
date=`date +%F`
for file in $*
do
if [ ! -e $file ]
then
echo file not existed
exit
fi
if [ -e $file$date ]
then
echo are you sure to override this existed updated file?
read answer
if [ $answer != 'y' ]
then
exit
fi
else
touch $file$date
fi
done
ls $* | xargs -n1 -i cp ./{} ./{}$date
ls $* | xargs -n1 -i echo copy from ./{} to ./{}$date is done