029_shell编写工作常用工具类总结

时间:2023-03-09 19:58:50
029_shell编写工作常用工具类总结

一、检查命令的执行结果

function check_result() {
result=$?
flag=$1
if [[ "$result"x == "0"x ]];then
echo "###############$flag is OK.###############"
else
echo "###############$flag is Failed.###########"
exit -1
fi
}

调用

check_result "cat conf/channel.conf > flume-agent.properties"

相关文章