一、检查命令的执行结果
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"