#!bin/bash
function choice(){
read -p $1 str
if [ "$str" = "y" -o "$str" = "Y" ]
then
echo "OK,continue"
$2
elif [ $"str" = "n" -o "str" = "N" ]
then
echo "oh,intereput"
else
echo "I Don‘t know what your choice id"
if
}
function copyMvFun(){
echo "move habp8 start -${time}
if [ -d $HOME/backup/habp8_bak_${time} ]
then
echo "habp8_bak_"${time}" -is exises,move success!"
else
cd $HOME/app
mv habp8 $HOME/backup/habp8_bak_${time}
echo "move success!"
fi
}
function unZipFun(){
cd $HOME/update/$time
echo "exec unzip start"
unzip -o boz-web-1.0-SNAPSHOT.war -d $HOME/app/habp8
echo "unzip success!"
}
time=$(date "+%Y%m%d")
choice "IS-OR-NOT-EXEC-copyMvFun" copyMvFun $time
choice "IS-OR-NOT-EXEC-unZipFun" unZipFun $time