Linux bash fi
if..else..fi allows to make choice based on the success or failure of a command.
if..else..fi 允许根据命令的成功或失败进行选择。
if [ conditional expression ]
then
statement1
statement2
.
fi
if [ expression ]
then
Statement(s) to be executed if expression is true
fi
demo
if [ ! -x /usr/bin/axel ]
then echo "axel is not installed, perform this?(y/n)"
read ops
case $ops in
y) if apt-get install axel -y --force-yes
then echo "axel installed"
else echo "unable to install the axel. you are using sudo?" ; exit
fi ;;
n) echo "not possible usage apt-fast" ; exit ;;
esac
fi