易BASH的if else [英] easy BASH If Else

查看:127
本文介绍了易BASH的if else的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我不能让这出于某种原因

Ok I cant get this to work for some reason

 if /etc/mysql/my.cfn exist
    then goto end;
else bash install.sh;

end exit;;

在此先感谢,

Thanks in advance, Joe

推荐答案

下面是一个相对直译:

if [ -e /etc/mysql/my.cfn ]; then
    exit # Note: bash does not have a goto command
else
    bash install.sh
fi

或者,消除不相关的话情况,并反转测试:

Or, eliminate the irrelevant then condition, and invert the test:

if [ ! -e /etc/mysql/my.cfn ]; then
    bash install.sh
fi

这篇关于易BASH的if else的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆