压缩文件备份

#!/bin/sh

source=("../server" "../client")

target_dir="./"

date=$(date +%Y%m%d)

target="$target_dir$date.zip"

zip -qr $target ${source[0]} ${source[1]}

if [ $? = 0 ]
then
    echo "Back up SUCCESSFUL!"
else
    echo "Back up FAILED!"
fi

exit 0

编程技巧