使用丑陋的编程语言也能写出漂亮的代码。
true_then_run() {
condition=$1
action=$2
(${condition})
if [ $? -eq 0 ]
then
(${action})
else
echo "'$1' is false, don't run '$2'"
fi
}
false_then_run() {
condition=$1
action=$2
(${condition})
if [ $? -ne 0 ]
then
(${action …