From 1fc8f9567e76684819c85eee52cc5c569e328ffb Mon Sep 17 00:00:00 2001 From: deajan Date: Sun, 11 Dec 2016 23:03:07 +0100 Subject: [PATCH] Updated coding style --- dev/CODING_STYLE.TXT | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dev/CODING_STYLE.TXT b/dev/CODING_STYLE.TXT index a7ea20d..012766d 100644 --- a/dev/CODING_STYLE.TXT +++ b/dev/CODING_STYLE.TXT @@ -1,4 +1,5 @@ Coding style used for my bash projects (v3.0 Dec 2016) +As bash is clearly an error prone script language, we'll use as much standard coding as possible, including some quick and dirty debug techniques described here. ++++++ Header @@ -69,7 +70,7 @@ __CheckArguments will only trigger when the script is launched with _PARANOIA_DE Use the following convention for function definition: function SomeFunction { - __CheckArguments 0 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG + __CheckArguments 0 $# "$@" #__WITH_PARANOIA_DEBUG ... } @@ -81,7 +82,7 @@ Declare arguments before launching __CheckArguments: function AnotherFunction { local varName="${1}" local otherVarName="${2}" # This variable contains stuff - __CheckArguments 2 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG + __CheckArguments 2 $# "$@" #__WITH_PARANOIA_DEBUG ... } @@ -155,7 +156,7 @@ The basic way of doing is: cmd='"something '$somevar'" > some_file 2>&1' eval $cmd & -WaitForTaskCompletion $! 0 0 $FUNCNAME +WaitForTaskCompletion $! 0 0 1 0 true false true false retval=$? if [ $retval -ne 0 ]; then Logger "Some error message" "ERROR" $retval