#获取日期参数
dt=$( date +"%Y%m%d" )
yesterday=$(date -d "1 days ago $dt " +%Y%m%d)
file0=$(basename $0)
file=${file0%.*}
echo "args number : $# "
if [ $# -eq 2 ] ; then
dt=$2
yesterday=$(date -d "1 days ago $dt " +%Y%m%d)
table=$1
hivefile=$sqlhome"/"$table".sql"
# echo "hivefile: $hivefile "
if [ ! -e $hivefile ] ; then
echo "++++++++++++++ file not exist!! [$hivefile] +++++++++++++"
exit 1
fi
elif [ $# -eq 1 ] ; then
dt=$( date +"%Y%m%d" )
yesterday=$(date -d "1 days ago $dt " +%Y%m%d)
table=$1
hivefile=$sqlhome"/"$table".sql"
if [ ! -e $hivefile ] ; then
echo "++++++++++++++ file not exist!! [$hivefile] +++++++++++++"
exit 1
fi
else
echo " +++++++++++++ command format error!! +++++++++++++ "
exit 1
fi