From 058d4c6c131a396016130fd65f0d5bdb8af584fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 24 Jan 2022 09:56:46 +0100 Subject: [PATCH] Updated Code Style Guide (markdown) --- Code-Style-Guide.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Code-Style-Guide.md b/Code-Style-Guide.md index 4a81ff8..f171eb2 100644 --- a/Code-Style-Guide.md +++ b/Code-Style-Guide.md @@ -342,7 +342,7 @@ fi ### Naming Conventions -Lower-case, with underscores to separate words. Parentheses are required after the function name. The `function` keyword is optional when `()` is present after the function name, but it aids readability and prevents [conflicts with alias declarations](https://zsh.sourceforge.net/Doc/Release/Shell-Grammar.html#Aliasing). But the POSIX specification says "`fname() compound-command[io-redirect ...]`", so we prefer the default from the specification! +Lower-case, with underscores to separate words. Parentheses are required after the function name. The `function` keyword is optional when `()` is present after the function name, but it aids readability and prevents [conflicts with alias declarations](https://zsh.sourceforge.net/Doc/Release/Shell-Grammar.html#Aliasing). The opening brace should appear on the same line as the function name. @@ -357,7 +357,7 @@ function my_bad_func { ##### _Good:_ ```shell -my_good_func() { +function my_good_func() { ... } @@ -447,7 +447,7 @@ fi ```shell mv "${file_list}" "${dest_dir}/" -if [[ "$?" -ne 0 ]]; then +if [[ $? -ne 0 ]]; then echo "Unable to move ${file_list} to ${dest_dir}" >&2 exit 1 fi