#!/bin/bash
#this shell is create by [email protected]
filename=`date  +%Y%m%d%H%M%S`
echo -n "please input backup directory name:"
read directory
if [ ! -d $directory ]
then
echo 2>&1 >> /dev/null
echo -e    "\033[41;37;5m $directory is not in thid directory ,please check your input!\033[0m"
else

tar -cf   $directory-$filename.tar   $directory
fi
if [ -f   $directory-$filename.tar  ]
then
echo  "$directory backup successed ! backup name is $directory-$filename.tar"
else
echo -e    "\033[41;37;5m warning $directory backup fail,please check!\033[0m"
fi