多余的分号在shell脚本一行结束了吗? [英] Semicolons superfluous at the end of a line in shell scripts?

查看:454
本文介绍了多余的分号在shell脚本一行结束了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个shell脚本包含以下内容:

I have a shell script which contains the following:

case $1 in
    0 )
    echo $1 = 0;
    OUTPUT=3;;
    1 )
    echo $1 = 1;
    OUTPUT=4;;
    2 )
    echo $1 = 2;
    OUTPUT=4;;
esac

HID=$2;
BUNCH=16;
LR=.008;

是分号完全是多余的在上面的代码片段?而且没有任何理由对某些人的使用双分号?

Are Semicolons completely superfluous in the snippet above? And is there any reason for some people's using double semicolons?

这似乎分号只是一个分隔符,你需要这个,而不是使用新的生产线。

It appears semicolons are only a separator, something you would use instead of a new line.

推荐答案

在一行的末尾单分号是多余的,因为换行符也是命令分隔符。 情况特别需要在每个图案块中的最后一个命令的结束双分号;看帮助的情况下了解详情。

Single semicolons at the end of a line are superfluous, since the newline is also a command separator. case specifically needs double semicolons at the end of the last command in each pattern block; see help case for details.

这篇关于多余的分号在shell脚本一行结束了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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