背景
系统:centos7
系统自带:/etc/init.d/functions
系统自带:/bin/true
系统自带:/bin/false
测试脚本
#!/bin/bash
source /etc/init.d/functions
abc clear data
if [ $? -eq 0 ]; then
action "abc清理数据" /bin/true
else
action "abc清理数据" /bin/false
fi
abc open data
if [ $? -eq 0 ]; then
action "abc打开数据" /bin/true
else
action "abc打开数据" /bin/false
fi
abc close data
if [ $? -eq 0 ]; then
action "abc关闭数据" /bin/true
else
action "abc关闭数据" /bin/false
fi