Linux bash fi
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
https://stackoverflow.com/questions/7010830/bash-whats-the-use-of-fi
refs
https://bash.cyberciti.biz/guide/If..else..fi
https://www.tutorialspoint.com/unix/if-fi-statement.htm
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/14204022.html
未经授权禁止转载,违者必究!

 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号