Bash convention for if ; then

后端 未结 5 780
野趣味
野趣味 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 11:57

    Semicolon ; is an operator (not a keyword, like braces { }or a bang !) in Shell, so it doesn't need to be delimited with white space to be recognized in any POSIX-compliant shell.

    However, doing so improves readability (for my taste).

    Semicolon needs to be escaped if you mean a symbol "semicolon", not an operator.

提交回复
热议问题