Bash convention for if ; then

后端 未结 5 779
野趣味
野趣味 2021-02-15 11:42

From this web page :

http://tldp.org/LDP/abs/html/abs-guide.html

It\'s mentioned the usage of the if bracket then convention which need a space after the semicol

5条回答
  •  粉色の甜心
    2021-02-15 12:09

    I do not believe that the space should be necessary there. There's nothing about requiring spaces in the POSIX sh spec.

    Empirically, the following works fine in both bash 4.1.5(1) and dash:

    $ if true;then echo hi;else echo bye;fi
    hi
    $ 
    

提交回复
热议问题