shell脚本,没有测试就上线,else if 异常没有发现
成年人的崩溃o(≧口≦)o瞬间……
首先注意这是正确的写法:
for i in $tablesName
do
if [[ "$i" =~ ^wy_* ]];then
echo "drop table "$i";" >>rt.txt
elif [[ "$i" =~ ^dim_* ]];then
echo "drop table "$i";" >>rt.txt
else
echo "drop table "$i"_h;" >>rt.txt
fi
done
下面是错误写法:
for i in $tablesName
do
if [[ "$i" =~ ^wy_* ]];then
echo "drop table "$i";" >>rt.txt
else if [[ "$i" =~ ^dim_* ]];then
echo "drop table "$i";" >>rt.txt
else
echo "drop table "$i"_h;" >>rt.txt
fi
done
shell脚本,一定要测试,一定要注释或切换过执行脚本,测试参数或运行指令!!!