CodingGuidelines: give an example for case/esac statement
authorJunio C Hamano <gitster@pobox.com>
Wed, 30 Apr 2014 21:24:08 +0000 (14:24 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 2 May 2014 20:24:57 +0000 (13:24 -0700)
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/CodingGuidelines
index c405b0b9dff81fa00c5aa03ba6cb2222dceac9f8..169b4358c93a8406a7fff10de3529e95cf6b7018 100644 (file)
@@ -42,7 +42,17 @@ For shell scripts specifically (not exhaustive):
 
  - We use tabs for indentation.
 
 
  - We use tabs for indentation.
 
- - Case arms are indented at the same depth as case and esac lines.
+ - Case arms are indented at the same depth as case and esac lines,
+   like this:
+
+       case "$variable" in
+       pattern1)
+               do this
+               ;;
+       pattern2)
+               do that
+               ;;
+       esac
 
  - Redirection operators should be written with space before, but no
    space after them.  In other words, write 'echo test >"$file"'
 
  - Redirection operators should be written with space before, but no
    space after them.  In other words, write 'echo test >"$file"'