From b8f18ac86099e3259cc387a4d14e2309b1e16704 Mon Sep 17 00:00:00 2001 From: deajan Date: Wed, 17 Oct 2018 23:52:46 +0200 Subject: [PATCH] Update coding conventions --- dev/CODING_CONVENTIONS.TXT | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dev/CODING_CONVENTIONS.TXT b/dev/CODING_CONVENTIONS.TXT index 4a9a162..bb553f9 100644 --- a/dev/CODING_CONVENTIONS.TXT +++ b/dev/CODING_CONVENTIONS.TXT @@ -1,4 +1,4 @@ -Coding style used for my bash projects (v3.0 Dec 2016) +Coding style used for my bash projects (v3.2 Oct 2018) 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 @@ -162,6 +162,15 @@ if [ $retval -ne 0 ]; then Logger "Some error message" "ERROR" $retval fi +++++++ includes + +Using merge.sh, the program may have includes like +include #### RemoteLogger SUBSET #### +All possible includes are listed in ofunctions.sh +Mostly, includes are needed to port functions to a remote shell without writing them again. + +++++++ Remote execution + Remote commands should always invoke bash (using '"'"' to escape single quotes of 'bash -c "command"'). It is preferable to use ssh heredoc in order to use plain code. If local and remote code is identical, wrap remote code in a function so only minor modifications are needed. Remote code return code is transmitted via exit. @@ -184,6 +193,9 @@ if [ $retval -ne 0 ]; then Logger "Some error message" "ERROR" $retval fi +We also need to transmit a couple of environment variables (RUN_DIR; PROGRAM; _LOGGER_VERBOSE... see current setups) in order to make standard code. +Include works here too. + ++++++ File variables All eval cmd should exit their content to a file called "$RUNDIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID"